Django application not visible

后端 未结 1 1733
难免孤独
难免孤独 2021-01-15 14:01

I am trying to deploy a Django application for the first time using mod_wsgi with Apache on a Ubuntu 12.04 VM. I have been following s

1条回答
  •  失恋的感觉
    2021-01-15 14:38

    The address you are going to in your browser does not match either the ServerName or ServerAlias directives in your Apache configuration, so the virtualhost won't know to respond to that request.

    Note that ServerAlias should be similar to ServerName - a hostname, not a URL, without http prefix or path. Also note you can have multiple values for ServerAlias if you need that virtualhost to respond to many hostnames.

    If you want the Django app to be served underneath /bias_experiment, that should be part of the WSGIScriptAlias.

    So it should be:

    ServerAlias phaedrus.scss.tcd.ie
    WSGIScriptAlias /bias_experiment /var/www/bias_experiment/src/bias_experiment/index.wsgi
    

    Also I'm confused about the locations of your code. Is it in /var/www/... or /home/whoever/var/www? Your wsgi file refers to the latter, but the Apache conf has the former.

    Next, virtualenv is supposed to take care of setting all the Python paths. So since you are running the activate script, you can remove the lines that modify sys.path and site.addsitedir. Although you might need to keep the one that adds the src directory.

    Another problem is with your DJANGO_SETTINGS_MODULE. It should be a Python module, not a file path - actually what you have is a cross between them both. Since src is on the Python path, you can just set this to 'bias_experiment.settings'.

    0 讨论(0)
提交回复
热议问题