1

I have uploaded my first Django Application called survey (Its a work in progress) using mod_wsgi with Apache on an Ubuntu VM but I don't know what the URL of it should be. My VM has been made public through a proxyPass at http://phaedrus.scss.tcd.ie/bias_experiment.

When working on my application locally I simply go to http://127.0.0.1:8000/surveythree/ Based on my urls.py (below) I thought that I would simply have to go to http://phaedrus.scss.tcd.ie/bias_experiment/surveythree/ to see my Survey application online. However I cant seem to find it...

My question: What URL should I be using to locate my Survey Application based on my below settings? Or have I missed some other step in the process?

The project has been uploaded, I have restarted the server, I have set it running with python manage.py runserver

Some of the urls I have tried

Below is my setup and what I have tried so far.

NOTE: I have a Bias_Experiment Django Project created in Pydev. It has three applications contained within an src folder.

  • survey (my working project)
  • polls (a tutorial i was following)
  • bias_experiment (the root application with my settings file etc)

My URL patterns 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/apache2/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

enter image description here

I had a previous question related to this which had multiple issues pointed out to me which I have since fixed so I am re-posting this here. I have been following several tutorials as details in that question.

Any help with this would be massively 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# 
Community
  • 1
  • 1
Deepend
  • 4,057
  • 17
  • 60
  • 101
  • Do you have access to the Apache error log? It would be useful to know what that says. Also what exactly do you see at the non-working URLs? – Daniel Roseman Jun 13 '14 at 16:14
  • @DanielRoseman I see a "404 Not Found" error page with "Not Found The requested URL /bias_experiment/surveythree/ was not found on this server. Apache/2.2.22 (Ubuntu) Server at 134.226.38.147 Port 80" No I do not have access to the error logs – Deepend Jun 13 '14 at 16:19
  • I should see the first page of a very simple user survey. – Deepend Jun 13 '14 at 16:22

3 Answers3

1

The URL should be http://phaedrus.scss.tcd.ie/bias_experiment/surveythree/

I think there is one tiny error in the Apache configuration, which might be my fault (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 manage.py runserver, that's pointless as Apache is serving your app.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
0

Is this it in your /static/ folder?

http://phaedrus.scss.tcd.ie/bias_experiment/static/

CowardlyFrench
  • 425
  • 1
  • 4
  • 6
  • It is but it is not my application but rather just a twitter bootstrap front end I will be adding later. – Deepend Jun 13 '14 at 16:41
-1

Try with this 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.

elmonkeylp
  • 2,674
  • 1
  • 16
  • 14