Django application not visible

杀马特。学长 韩版系。学妹 提交于 2019-12-01 10:45:41

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'.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!