admin/appname/modelname url 不适用于 Django 1.1rc1 中的 mod_wsgi
我在 Ubuntu 上使用 Django 1.1 rc1 和 Apache 2.2.8 以及 mod_wsgi 1.3.1 + Python 2.5.2。
Django 的内部测试 Web 服务器一切正常,但在迁移到 Apache mod_wsgi 后,所有像 /admin/appname/modelname/
这样的 url 开始不起作用。 他们显示 404 not found 错误,并显示以下日志:
...
^admin/ ^$
^admin/ ^logout/$
^admin/ ^password_change/$
^admin/ ^password_change/done/$
^admin/ ^jsi18n/$
^admin/ ^r/(?P<content_type_id>\d+)/(?P<object_id>.+)/$
^admin/ ^(?P<app_label>\w+)/$
The current URL, admin/account/userprofile/, didn't match any of these.
奇怪的是,/admin/appname/
和所有其他部分(包括我的自定义网址)都工作正常。
是Django的bug还是配置问题? 以及如何解决呢?
I'm using Django 1.1 rc1 and Apache 2.2.8 on Ubuntu with mod_wsgi 1.3.1 + Python 2.5.2.
Everything worked fine with Django's internal testing web server, but after migrating to Apache mod_wsgi, all urls like /admin/appname/modelname/
began not to work. They shows 404 not found errors with the following log:
...
^admin/ ^$
^admin/ ^logout/$
^admin/ ^password_change/$
^admin/ ^password_change/done/$
^admin/ ^jsi18n/$
^admin/ ^r/(?P<content_type_id>\d+)/(?P<object_id>.+)/$
^admin/ ^(?P<app_label>\w+)/$
The current URL, admin/account/userprofile/, didn't match any of these.
Strangely, /admin/appname/
and all other parts including my custom urls just work fine.
Is it a bug of Django or configuration issue? And how to solve it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道 1.1RC1 对管理 URL 解析器进行了一些更改以使用名称空间:这可能是您的问题。
请参阅此处: http://docs.djangoproject.com/en/ dev/releases/1.1-rc-1/
除此之外,URL 看起来不正确,因为调试跟踪中的最后一行 url 只匹配 /admin/app/ 而不是 /admin/app /xxxx。 此处的信息可能会有所帮助。
由于某种原因,这个 ^admin/ ^r/(?P\d+)/(?P.+)/$ 看起来不正确,这不是给 /admin//xxx/yyy/ 吗?
编辑:不,它给出了 /admin/r/xxx/yyy/
我现在无法测试这个,因为我在这台计算机上只有 1.0.2 可用(并且没有 mod_wsgi) - 我将测试今晚我回到家时1.1。
编辑:由于某种原因,这似乎
不起作用,因为 URL 未包含在调试跟踪的搜索路径中。 admin.py 文件是否正确?
I know that 1.1RC1 made some changes to the admin URL resolver to use namespaces: this might be your problem.
see here: http://docs.djangoproject.com/en/dev/releases/1.1-rc-1/
Other than that it looks like the URLs are not correct as the last line of the urls in the debug trace would only match /admin/app/ rather than /admin/app/xxxx. The information here might help.
for some reason this ^admin/ ^r/(?P\d+)/(?P.+)/$ doesn't look right wouldn't that give /admin//xxx/yyy/ ?
Edit: no it gives /admin/r/xxx/yyy/
I can't test this right now as I only have 1.0.2 available on this computer (and no mod_wsgi) - I will test on 1.1 when I get home tonight.
Edit: Looks like this
is not working for some reason, as the URLs are not included in the search path in the debug trace. Are the admin.py files correct?