Linking to the django admin site

后端 未结 2 1799
名媛妹妹
名媛妹妹 2020-12-24 05:55

Very basic question, but I\'m having trouble tracking down the answer on the web. I have a template, which I want to link to the django admin site (i.e. localhost:8000/admin

2条回答
  •  一向
    一向 (楼主)
    2020-12-24 06:39

    Which django version are you using? If you're using trunk, change your admin urlpatterns from:

    (r'^admin/(.*)', admin.site.root)
    

    to:

    ('^admin/', include(admin.site.urls))
    

    And then you get a named URL pattern called 'admin_index' which you can refer to. See

    http://docs.djangoproject.com/en/dev/ref/contrib/admin/#reversing-admin-urls

    for more information

提交回复
热议问题