Django 找不到 admin.sites.url

发布于 2024-10-21 01:56:34 字数 577 浏览 1 评论 0原文

我正在使用 rc1.3 在本地开发一个 django 站点,在对 urls.py 文件进行了一些调整后,我收到了 django 无法导入 admin.site.urls 的错误消息。通过 urls.py 文件如下。

urlpatterns = patterns('',
# Example:

(r'^city/$', 'venue.views.city_index'),
(r'^accounts/', include('registration.urls')),
(r'^accountss/', include('registration.backends.simple.urls')),
(r'^profiles/', include('profiles.urls')),
(r'^admin/', include('admin.site.urls')),

(r'^city/(?P<city>[-\w]+)/$', 'venue.views.city_detail'),
(r'^city/(?P<city>[-\w]+)/venue/$', 'venue.views.venue_index'),
)

知道可能是什么原因造成的,谢谢。

I am developing a django site locally using rc1.3 and after making several adjustments to my urls.py file i am receiving error messages that django cannot import admin.site.urls. by urls.py file is below.

urlpatterns = patterns('',
# Example:

(r'^city/

Any idea what might be cause this, thanks.

, 'venue.views.city_index'), (r'^accounts/', include('registration.urls')), (r'^accountss/', include('registration.backends.simple.urls')), (r'^profiles/', include('profiles.urls')), (r'^admin/', include('admin.site.urls')), (r'^city/(?P<city>[-\w]+)/

Any idea what might be cause this, thanks.

, 'venue.views.city_detail'), (r'^city/(?P<city>[-\w]+)/venue/

Any idea what might be cause this, thanks.

, 'venue.views.venue_index'), )

Any idea what might be cause this, thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

满栀 2024-10-28 01:56:34

http://docs.djangoproject.com/en/ dev/intro/tutorial02/#activate-the-admin-site

不要包含字符串路径,实际导入管理模块并指向其网址。

from django.contrib import admin

urlpatterns += patterns('',
    (r'^admin/', include(admin.site.urls)),
)

http://docs.djangoproject.com/en/dev/intro/tutorial02/#activate-the-admin-site

Don't include the string path, actually import the admin module and point to its urls.

from django.contrib import admin

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