Good day to all of you,
together with our admin in our company, we're trying to deploy Django on Apache2 together with mod_wsgi, but we're facing some minor issues. I'm hoping, some of you might help and take a look at the following lines!?
Right now, the directory on our server is looking like this:
./var/www/
|-- myproject
|-- manage.py
|-- project/
|-- __init__.py
|-- settings.py
|-- urls.py
|-- wsgi.py
|-- statics
|-- venv
When I'm trying to open the site, it just keeps on loading but nothings gonna happen! I'm wondering wether the data inside our .conf-file might be wrong!
<VirtualHost *:80>
. . .
Alias /static /var/www/myproject/static
<Directory /var/www/myproject/static>
Require all granted
</Directory>
<Directory /var/www/myproject/project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess myproject python-path=/var/www/myproject python-home=/var/www/myproject/venv
WSGIProcessGroup myproject
WSGIScriptAlias / /var/www/myproject/project/wsgi.py
</VirtualHost>
If I understood it correctly, the "python-home" inside the "WSGIDaemonProcess" should point onto my Virtual Environment to collect the necessary components and the "python-path" onto my project!?
import os
import time
import traceback
import signal
import sys
from django.core.wsgi import get_wsgi_application
sys.path.append('/var/www/myproject/project')
sys.path.append('/var/www/myproject/venv/lib/python3.7/site-packages')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
try:
application = get_wsgi_application()
except Exception:
# Error loading applications
if 'mod_wsgi' in sys.modules:
traceback.print_exc()
os.kill(os.getpid(), signal.SIGINT)
time.sleep(2.5)
Does the second "sys.get.append" has to point to my venv or to the location where our admin installed the actutal python-version(3.7)?
I also noticed, that the current running python-version on the server is 2.7.6, although my admin installed version 3.7. The installed mod_wsgi is "libapache2-mod-wsgi-py3" for python 3x! Could this also be a problem?
Thanks and a great day to all of you!