1

I am moving my Django site to a new server and I cannot get it running on the new server. I had it running previously, but I fumbled through that a year ago and don't really remember the details.

  • Ubuntu 16.04 Server
  • Python 3.5.2
  • Django 1.10.3
  • Apache 2.4.18
  • Mod_wsgi 4.5.7

I built mod_wsgi from source and loaded it. When I restart Apache I see:

Apache/2.4.18 (Ubuntu) mod_wsgi/4.5.7 Python/3.5 configured -- resuming normal operations

so I think I did that correctly.

$ ls /etc/apache2/sites-enabled/
stock.conf

$ cat /etc/apache2/sites-enabled/stock.conf
<VirtualHost tesla:80>
        ServerName tesla

        ServerAdmin webmaster@localhost
        DocumentRoot /nfs/stock_tracker/web

        WSGIDaemonProcess stock_tracker
        WSGIProcessGroup stock_tracker
        WSGIScriptAlias / /nfs/stock_tracker/web/dj/wsgi.py

        <Directory /nfs/stock_tracker/web/dj>
          Require all granted
          <Files wsgi.py>
            Require all granted
          </Files>
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

$ cat /nfs/stock_tracker/web/dj/wsgi.py
"""
WSGI config for dj project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""

import os
import time
import traceback
import signal
import sys
from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dj.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)

I also added this to apache2.conf so my files can be in directory I want:

<Directory /nfs/stock_tracker>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

Apache restarts without errors. Everything seems to be correct, but I always just get the Apache default page.

Any idea what I am missing?

Let me know what other information would be important to add. One of the problems is that I'm not getting errors so it's a bit of a mystery.

0

You must log in to answer this question.

Browse other questions tagged .