changing admin site url

孤人 提交于 2021-01-27 08:01:19

问题


Is there a way to change the url to open the admin site in django? I don't want to use the default /admin url. I am new to django so please try giving a bit more detailed information.


回答1:


In urls.py, change the line that reads:

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

to something like:

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

so now instead of http://example.com/admin you'd use http://example.com/new_admin




回答2:


Sure, the file urls.py in the root of your project maps URLs to handlers. Just change the line

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

more from Django tutorial



来源:https://stackoverflow.com/questions/968380/changing-admin-site-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!