Python Django应用程序的URL应该是什么
我已经在Python Django应用程序的URL应该是什么,python,django,apache,python-2.7,Python,Django,Apache,Python 2.7,我已经在UbuntuVM上使用mod_wsgi和Apache上传了我的第一个Django应用程序,名为survey(这是一项正在进行的工作),但我不知道它的URL应该是什么。我的虚拟机已在上通过proxyPass公开 在本地处理应用程序时,我只需转到http://127.0.0.1:8000/surveythree/基于我的URL.py(见下文),我认为我只需上网查看我的调查应用程序即可。然而,我似乎找不到它 我的问题:根据下面的设置,我应该使用什么URL来定位我的调查应用程序?或者我是否错过了
Ubuntu
VM上使用mod_wsgi
和Apache
上传了我的第一个Django应用程序,名为survey(这是一项正在进行的工作),但我不知道它的URL应该是什么。我的虚拟机已在上通过proxyPass公开
在本地处理应用程序时,我只需转到http://127.0.0.1:8000/surveythree/
基于我的URL.py(见下文),我认为我只需上网查看我的调查应用程序即可。然而,我似乎找不到它
我的问题:根据下面的设置,我应该使用什么URL来定位我的调查应用程序?或者我是否错过了这个过程中的其他步骤
项目已上载,我已重新启动服务器,我已使用python manage.py runserver将其设置为运行
我尝试过的一些URL
下面是我的设置和我迄今为止尝试的内容
注意:我在Pydev中创建了一个Bias_实验Django项目。它在src文件夹中包含三个应用程序
- 调查(我的工作项目)
- 民意测验(我正在学习的教程)
- 偏差试验(带有我的设置文件等的根应用程序)
我的URL模式来自bias\u实验/src/bias\u实验/URL.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])),
)
我的虚拟主机位于/etc/apache2/sites available/bias\u
<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 >
这是项目结构
我有一个有多个问题向我指出,我已经修复,所以我重新张贴在这里。在这个问题上,我一直在关注一些教程的细节
对此,我们将不胜感激
谢谢Deepend
编辑:我的Apache错误日志: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#
尝试以下更改:
Apache配置文件:
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
您需要重新启动Apache服务器。URL应该是
我认为Apache配置中有一个小错误,可能是我的错(对不起):您需要一个尾随斜杠,所以:
WSGIScriptAlias /bias_experiment/ /var/www/bias_experiment/src/bias_experiment/index.wsgi
还请注意,您不需要运行manage.py runserver,这是毫无意义的,因为Apache正在为您的应用程序提供服务。这是您的/static/文件夹中的吗
您有权访问Apache错误日志吗?了解这句话会很有用。另外,您在非工作URL上看到了什么?@DanielRoseman我看到一个“404未找到”错误页面,其中“未找到请求的URL/bias_experiment/surveytree/未在此服务器上找到。Apache/2.2.22(Ubuntu)服务器位于134.226.38.147端口80”不,我没有访问错误日志的权限。我应该看到一个非常简单的用户调查的第一页。没有必要为给他们你的时间而道歉。我做了改变。不幸的是,没有快乐。我还重新启动了服务器。当你说你重新启动服务器时,你到底在运行什么命令?sudo service apache2 restartHmm。如果你能运行sudo,您应该能够在/var/log/apache2中看到Apache日志:尝试执行sudo su
然后执行tail/var/log/apache2/error.log
。另一个想法是:您是否执行了a2ensite bias\u实验
或将您的Apache站点从可用站点复制/符号链接到启用的站点?它不是我的应用程序,只是一个twitter我稍后将添加引导前端。如果我的答案与已验证为最佳的答案相同,为什么会得到-1?还有更多的选择:s
WSGIScriptAlias /bias_experiment/ /var/www/bias_experiment/src/bias_experiment/index.wsgi