right now I'm trying - for the first time - to deploy a Django-Application on a Apache2 with mod_wsgi and it's still not working the way I wish it would. Anyway, I'm arguing with my Admin who says I don't have to restart the server after making changes to my python code, only if there are changes to the .conf-files. The tutorials online are also not that useful for this specific problem! Some say "A", some say "B" and some don't mention this topic at all.
<VirtualHost *:80>
ServerName webapp.company.local
ServerAlias cmp-workbench.company.local
ServerAdmin webmaster@localhost
DocumentRoot /var/www/cmp-workbench
#for django
Alias /static /var/www/cmp-workbench/static
<Directory /var/www/cmp-workbench/static>
Require all granted
</Directory>
<Directory /var/www/cmp-workbench/cmp_workbench>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess cmp-workbench python-path=/var/www/cmp-workbench python-home=/var/www
/cmp-workbench/cmp_workbench
WSGIProcessGroup cmp-workbench
WSGIScriptAlias / /var/www/cmp-workbench/cmp_workbench/wsgi.py
ErrorLog ${APACHE_LOG_DIR}/error_cmp-workbench.log
CustomLog ${APACHE_LOG_DIR}/access_cmp-workbench.log combined
</VirtualHost>
import os
import time
import traceback
import signal
import sys
from django.core.wsgi import get_wsgi_application
sys.path.append('/var/www/cmp-workbench-stage/cmp_workbench_stage')
sys.path.append('/var/www/cmp-workbench-
stage/cmp_workbench_stage/env/lib/python3.7/site-packages')
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'cmp_workbench_stage.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)
Can someone who already deployed this way answer to my problem? Thanks and a great weekend!