Django 展示“It Worked”;页面 50% 的时间

发布于 2025-01-02 23:11:15 字数 536 浏览 4 评论 0原文

我在我的主项目中的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

離人涙 2025-01-09 23:11:15

您正在访问user/register,当您的网址为user/register/时,

您是否删除了CommonMiddleware 从您的设置中?如果它是有效的模式,它应该正确重定向到带有 / 的 URL。

You are visiting user/register, when your url is user/register/

Did you remove CommonMiddleware from your settings? It should redirect correctly to the URL with the / if its a valid pattern.

累赘 2025-01-09 23:11:15

事实证明,令人尴尬的是,我重新启动 lig​​httpd 以使应用程序再次工作,而不是实际的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文