什么应该是我的Django应用程序的URL [英] What should be the URL of my Django Application
问题描述
我已经使用 / code>在 我认为Apache配置有一个小错误,这可能是我的错(对不起):你需要一个尾部的斜杠,所以: 另请注意,您不需要运行manage.py runserver,这是毫无意义的因为Apache正在为您的应用服务。 I have uploaded my first Django Application called survey (Its a work in progress) using When working on my application locally I simply go to 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 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. My URL patterns from bias_experiment/src/bias_experiment/urls.py My virtual host located at /etc/apache2/sites-available/bias_experiment My WSGI file located at /var/www/bias_experiment/src/bias_experiment/index.wsgi This is the project structure 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:
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: Also note that you don't need to run manage.py runserver, that's pointless as Apache is serving your app. 这篇关于什么应该是我的Django应用程序的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! mod_wsgi
与 Apache
Ubuntu
虚拟机,但我不知道它的URL应该是什么。我的虚拟机已通过proxyPass公开发布,网址为
WSGIScriptAlias / bias_experiment / / var / www / bias_experiment / src / bias_experiment /index.wsgi
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.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...python manage.py runserver
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])),
)
<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 >
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()
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#
WSGIScriptAlias /bias_experiment/ /var/www/bias_experiment/src/bias_experiment/index.wsgi