What should be the url of my Django app
I uploaded my first Django app named survey (in progress) using mod_wsgi
c Apache
on a Ubuntu
VM, but I don't know what the url is supposed to be. My VM has been made public via proxyPass at http://phaedrus.scss.tcd.ie/bias_experiment .
When working with my application locally I just go to http://127.0.0.1:8000/surveythree/
Based on my urls.py (below) I thought I just need to go to http://phaedrus.scss.tcd.ie/bias_experiment/surveythree/ to see my application Survey online. However, I cannot find it ...
My question is: What URL should I use to find my shooting app based on my settings below? Or am I missing some other step in this process?
The project was downloaded, I restarted the server, I installed it with python manage.py runserver
Some urls i have tried
- http://phaedrus.scss.tcd.ie/bias_experiment/surveythree/
- http://phaedrus.scss.tcd.ie/bias_experiment/src/surveythree/
- http://phaedrus.scss.tcd.ie/bias_experiment/src/bias_experiment/surveythree/
Below is my setup and what I have tried so far.
NOTE. I have a Django Bias_Experiment project created in Pydev. It contains three applications contained in the src folder.
- overview (my working draft)
- polls (tutorial I followed)
- bias_experiment (root application with my settings file, etc.)
My url templates from bias_experiment / src / bias_experiment / urls.py
urlpatterns = patterns('',
url(r'^polls/', include('polls.urls', namespace="polls")),
url(r'^admin/', include(admin.site.urls)),
url(r'^surveythree/$', SurveyWizard.as_view([SurveyForm1, SurveyForm2, SurveyForm3, SurveyForm4, SurveyForm5])),
)
My virtual host located at / etc / apache 2 / sites-available / bias_experiment
<VirtualHost *:80>
ServerAdmin myemail@gmail.com
ServerName phaedrus.scss.tcd.ie/bias_experiment
ServerAlias phaedrus.scss.tcd.ie
WSGIScriptAlias /bias_experiment /var/www/bias_experiment/src/bias_experiment/index.wsgi
Alias /static/ /var/www/bias_experiment/src/bias_experiment/static/
<Location "/static/">
Options -Indexes
</Location >
</VirtualHost >
My WSGI file located at / var / www / bias_experiment / src / bias_experiment / index.wsgi
import os
import sys
import site
# This is to add the src folder
sys.path.append('/var/www/bias_experiment/src/bias_experiment')
os.environ['DJANGO_SETTINGS_MODULE'] = 'bias_experiment.settings'
# Activate your virtual env
activate_env=os.path.expanduser("/var/www/bias_experiment/bin/activate_this.py")
execfile(activate_env, dict(__file__=activate_env))
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
This is the project structure
I had a previous question related to this that pointed out a few questions that I fixed, so I am rewriting that here. I consider several tutorials as details of this question.
Any help with this would be greatly appreciated.
Thanks Deepend
EDIT: My Apache error log: tail /var/log/apache2/error.log
(bias_experiment)spillab@kdeg-vm-18:/var/www/bias_experiment/src$ sudo su
root@kdeg-vm-18:/var/www/bias_experiment/src# tail /var/log/apache2/error.log
[Fri Jun 13 16:21:04 2014] [error] [client 134.226.38.233] File does not exist: /var/www/bias_experiment/surveythree, referer: https://stackoverflow.com/questions/24209181/what-should-be-the-url-of-my-django-application/24209864?noredirect=1
[Fri Jun 13 16:22:36 2014] [error] [client 134.226.38.233] PHP Notice: Use of undefined constant PHP_SELF - assumed 'PHP_SELF' in /var/www/bias_experiment/brendy.php on line 24, referer: http://phaedrus.scss.tcd.ie/bias_experiment/
[Fri Jun 13 16:22:36 2014] [error] [client 134.226.38.233] PHP Notice: Undefined index: brendy in /var/www/bias_experiment/brendy.php on line 27, referer: http://phaedrus.scss.tcd.ie/bias_experiment/
[Fri Jun 13 16:22:36 2014] [error] [client 134.226.38.233] PHP Notice: Use of undefined constant action - assumed 'action' in /var/www/bias_experiment/brendy.php on line 72, referer: http://phaedrus.scss.tcd.ie/bias_experiment/
[Fri Jun 13 16:22:36 2014] [error] [client 134.226.38.233] PHP Notice: Undefined index: action in /var/www/bias_experiment/brendy.php on line 72, referer: http://phaedrus.scss.tcd.ie/bias_experiment/
[Fri Jun 13 16:22:36 2014] [error] [client 134.226.38.233] PHP Warning: include(footer.php): failed to open stream: No such file or directory in /var/www/bias_experiment/brendy.php on line 118, referer: http://phaedrus.scss.tcd.ie/bias_experiment/
[Fri Jun 13 16:22:36 2014] [error] [client 134.226.38.233] PHP Warning: include(): Failed opening 'footer.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/bias_experiment/brendy.php on line 118, referer: http://phaedrus.scss.tcd.ie/bias_experiment/
[Fri Jun 13 16:22:37 2014] [error] [client 134.226.38.233] File does not exist: /var/www/bias_experiment/special.css, referer: http://phaedrus.scss.tcd.ie/bias_experiment/brendy.php
[Fri Jun 13 16:22:37 2014] [error] [client 134.226.38.233] File does not exist: /var/www/bias_experiment/images, referer: http://phaedrus.scss.tcd.ie/bias_experiment/brendy.php
[Fri Jun 13 16:22:37 2014] [error] [client 134.226.38.233] File does not exist: /var/www/bias_experiment/images, referer: http://phaedrus.scss.tcd.ie/bias_experiment/brendy.php
root@kdeg-vm-18:/var/www/bias_experiment/src#
source to share
URL should be http://phaedrus.scss.tcd.ie/bias_experiment/surveythree/
I think there is one tiny error in the Apache configuration that could be my mistake (sorry): you need a trailing slash, so:
WSGIScriptAlias /bias_experiment/ /var/www/bias_experiment/src/bias_experiment/index.wsgi
Also note that you don't need to run run.py runningerver, which is pointless since Apache is serving your application.
source to share
Try with these changes:
Apache conf:
WSGIApplicationGroup %{GLOBAL}
ServerName phaedrus.scss.tcd.ie
WSGIScriptAlias /bias_experiment/ /var/www/bias_experiment/src/bias_experiment/index.wsgi
WSGIDaemonProcess bias_experiment processes=4 threads=25 display-name=%{GROUP}
WSGIProcessGroup bias_experiment
WSGIPassAuthorization On
And you need to restart the Apache server.
source to share