Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我们可以$_SERVER['SERVER_NAME']在 php 中使用来获取当前域名。现在想根据当前域名在django的setting.py中设置ROOT_URLCONF,该怎么办呢?
$_SERVER['SERVER_NAME']
您可以使用包django-hosts为您执行此操作。它根据域名更改 url conf。它在中间件层执行此操作。
这很容易设置。