Django 展示“It Worked”;页面 50% 的时间
我在我的主项目中的 urls.py 文件中设置了 URL,如下所示:
urlpatterns = patterns('',
url(r'^$',gamelog.views.frontpage,name='home'),
url(r'^user/register/',gamelog.views.register,name='register'),
)
问题是,当我访问主页时,大约 50% 的情况下,我会看到“It Worked”页面,而另外 50% 的情况是我指定的实际视图。 但是,如果我访问 /user/register,50% 的时间是“It Worked”页面,另外 50% 的时间是 404:
Using the URLconf defined in project.urls, Django tried these URL patterns, in this order:
^/?$
The current URL, user/register, didn't match any of these.
I set up URLs in my urls.py file in my main project, like so:
urlpatterns = patterns('',
url(r'^
Problem is, about 50% of the time when I visit the homepage, I'll get the 'It Worked' page, and the other 50% is the actual view I designated.
However, if I visit /user/register, 50% of the time is the 'It Worked' page, and the other 50% is a 404 that says:
Using the URLconf defined in project.urls, Django tried these URL patterns, in this order:
^/?$
The current URL, user/register, didn't match any of these.
,gamelog.views.frontpage,name='home'),
url(r'^user/register/',gamelog.views.register,name='register'),
)
Problem is, about 50% of the time when I visit the homepage, I'll get the 'It Worked' page, and the other 50% is the actual view I designated.
However, if I visit /user/register, 50% of the time is the 'It Worked' page, and the other 50% is a 404 that says:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在访问
user/register
,当您的网址为user/register/
时,您是否删除了
CommonMiddleware
从您的设置中?如果它是有效的模式,它应该正确重定向到带有/
的 URL。You are visiting
user/register
, when your url isuser/register/
Did you remove
CommonMiddleware
from your settings? It should redirect correctly to the URL with the/
if its a valid pattern.事实证明,令人尴尬的是,我重新启动 lighttpd 以使应用程序再次工作,而不是实际的 FCGI 套接字(例如 FLUP)。
因此,解决方案是重新启动 PYTHON 服务器,而不是网络服务器。
我觉得自己像个白痴。
Turns out, embarrassingly enough, I was restarting lighttpd to make the app work again, not the actual FCGI socket (e.g. FLUP).
So, the solution is to restart the PYTHON server, not the webserver.
I feel like an idiot.