我如何为一个应用程序配置一个单独的域,并为其他应用程序配置另一个域。我尝试使用 django 站点 django-host。请分享示例
问问题
43 次
1 回答
0
假设有 2 个域main.example.com
和rest.example.com
,应用程序main_app
将托管在 上main.example.com
,应用程序的其余部分在 上rest.example.com
。
# project/hosts.py
from django_hosts import patterns, host
host_patterns = patterns('',
host('main', 'main_app.urls', name='main'),
host('rest', 'project.urls', name='rest'),
)
考虑到应用程序 URL 的其余部分是 on project.urls
。
于 2019-11-25T12:57:32.777 回答