Sunday, May 30, 2021

Re: Newbee help on deploying Django App to Apache2

I think, you are using the default python version installed on the machine, not the one of the virtualenv. 
You will have to configure the mod_wsgi to use the python of the virtuelanv.

This might help you. 
https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html#


Regards,
Chetan Ganji
+91-900-483-4183


On Sun, May 30, 2021 at 4:46 PM Moose Smith <47kangaroo@gmail.com> wrote:
App written in ubuntu virtual environment python 3.8.5. Works well on Visual Studio Code development server. Am trying to make it run on Apache2 development server.  I have been able to install WSGI module on Apache Server and ran a test Hello World in Python and it worked. However, the django app when ported over does not work. 
The error log confirms that the mod_wsgi has been created using by Python 3.8  
[mpm_event:notice] [pid 607786:tid 140700034231360] AH00489: Apache/2.4.41 (Ubuntu) mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations
The error I am getting indicates that the Apache / WSGI is reading the files in the virtual environment I copied over.  

mod_wsgi (pid=609049): Exception occurred processing WSGI script '/ File "/usr/public/apache/MCE/learn/djpro/wsgi.py", line 12, in <module>
from django.core.wsgi import get_wsgi_application
ModuleNotFoundError: No module named 'django'

My research indicates that this error occurs when the mod--wsgi in being interpreted by a different version than what was used to create my virtual environment. It also might be permissions/ownership issues with the file and directories copied over to the server, or improperly configured module. 

My question is this: Does the mod_WSGI module have to be the same as the one that created my virtual environment?  My understanding is that WSGI has two components, the server side, and the application side. It would not make sense that the Server side MUST match the application side because it would not be possible to service various apps with different versions of Python/Django. I assumed the server side was python version independent and that the requirement for Python similarity was only on the application side in that the Python used to create the virtual environment and my app must match the version used to create the WSGI interface on the application side (this side not the server). That said, I have discovered there is a Python 2.7 version of the mod_WSGI for the server side which differs from the 3.7 version. 

Can someone clear up the Python version requirement and if it does require a match between the server and the app side, how will I be able to run future versions of Python/Django apps without having to go back and "recomplie"?

Also if someone has any clues on solving my error that would be very much appreciated.

Thanks
Moose

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d3041741-1604-473f-8810-263bb3b16c59n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMKMUjuOXoG5O0-aGFpMD3wfkNHkOMqBf8PNsKhFeeJvwrpYAQ%40mail.gmail.com.

No comments:

Post a Comment