不同域上的Django管理员 [英] Django admin on different domain
本文介绍了不同域上的Django管理员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在其他域中访问Django后端(和某些视图)?
是否通过Sites Framework完成?
How can I make the Django backend (and some views) accessible in a different domain? Is it done via the Sites Framework?
推荐答案
创建 settings.py的副本
并使用该设置文件运行管理服务器。另外,创建一个 urls.py
的副本(我们称其为 admin_urls.py
)。然后,在复制的设置文件中更改以下行:
Create a copy of settings.py
and run the admin server with that settings file. Also, create a copy of urls.py
(let's call it admin_urls.py
). Then, in the copied settings file change this line:
ROOT_URLCONF = 'admin_urls.py'
要阻止访问主站点上的管理员,请从中的 INSTALLED_APPS
中删除管理员应用 settings.py
以及 urls.py
中对管理视图的所有引用。
To prevent access to admin on the main site, remove admin app from INSTALLED_APPS
in settings.py
and all references to admin views in urls.py
.
这篇关于不同域上的Django管理员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文