网址.py在djang

2024-04-18 19:20:07 发布

您现在位置:Python中文网/ 问答频道 /正文

问题是网址.pydjango项目中的文件如下所示:

urlpatterns = patterns('',
    ...
    url(r'^admin/', include(admin.site.urls)),
    url(r'^testapp/', include('testapp.urls')),  #Here is the problem.
)

我安装了一个应用程序,叫做“testapp”,所以我在模式中写了include('testapp.urls')。在

问题是,我为什么要在引号中加testapp.urls? 因为我试着这样说:url('r^testapp/', include(testapp.urls)),它没用。 为什么?在


Tags: 文件the项目urlhereincludeadminis