为什么模板路径不同,夹层中的渲染内容不同?

时间:2016-08-04 07:01:30

标签: python django multi-tenant mezzanine django-sites

我在夹层中有两个免费主题 - solid & moderna取自 - HERE

我只想运行HOST_THEMES的{​​{1}}功能。所以我继续加载我的mezzanine这两个主题 -

INSTALLED_APPS

我配置了我的代码并在INSTALLED_APPS = ( "moderna", "solid", "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.redirects", "django.contrib.sessions", "django.contrib.sites", "django.contrib.sitemaps", "django.contrib.staticfiles", "mezzanine.boot", "mezzanine.conf", "mezzanine.core", "mezzanine.generic", "mezzanine.pages", "mezzanine.blog", "mezzanine.forms", "mezzanine.galleries", "mezzanine.twitter", 'mezzanine_api', 'rest_framework', 'rest_framework_swagger', 'oauth2_provider', # "mezzanine.accounts", # "mezzanine.mobile", ) 上运行。然后我在我的0.0.0.0:8000设置中制作了两个主机

HOST_THEMES

每个人都想知道为什么我的主机中的HOST_THEMES = [("localhost:8000", "solid"), ("192.168.1.130:8000", "moderna")] 因代码中的这一行而被:8000

Line 25

如果我没有用端口设置我的主机,则相等失败。

在此之后,我正在逐步调试模板正在进行调试。 Host and themes match here clearly

还正确选择了模板目录: solid theme being picked up from my directory

As you can see in the <code>rendered_content</code> you will find moderna being rendered always because its on top and <code>template_name</code> being the template from <code>solid</code> directory

我究竟做错了什么?

1 个答案:

答案 0 :(得分:0)

嘿伙计我能通过以下方式解决这个问题 - 1.在Hosts

中制作自定义/etc/hosts

制作两个自定义主机并将它们绑定到我的IP并且它有效

我不知道为什么这不适用于localhost127.0.0.1