在单个django项目下有多个站点是否可能和正确。 因此,将有全局共享的sits文件,urls文件以及所有站点的全局共享“应用程序”以及单个django项目下所有站点的公共管理界面。 每个站点可能都有自己的设置,URL和模板,这些设置,URL和模板将被覆盖或动态导入父设置文件。
有谁能告诉我如何使用Python2.6 + Django 1.2.1 + Apache2.2 + mod_wsgi实现这一目标。 因为我对使用mod_wsgi时需要提供的虚拟主机有点困惑。
根据上述要求,我计划将wsgi文件保存在主django项目目录中,以便导入主设置,并在主设置中我计划动态导入请求的站点设置。这样可以使用Apache + mod_wsgi。 请指教。
要么
我必须创建一个全局共享模块,而不是全局django项目,以便将全局设置和URL详细信息导入特定于站点的设置和URL。
我想更好地重用代码,而不是在每个站点进行冗余更改。
请指教。
Is it possible and correct to have multiple sites under single django project. So that there will be globally shared sittings file,urls files along with global shared 'apps' for all the sites and a common admin interface for all the sites under the single django project. Each site might have its own setting,urls and templates that will be overridden or imported dynamically into the parent settings file.
Could anyone please tell me how to achieve this using Python2.6 + Django 1.2.1 + Apache2.2 + mod_wsgi. As I am a bit confused with the virtualhost need to be supplied while using the mod_wsgi.
As per the above requirement I am planning to keeping the wsgi file in the main django project directory so that the main settings will be imported and within the main setting I am planning to import the requested sites settings dynamically.Is it possible this way using Apache + mod_wsgi. Please advice.
OR
Instead of global django project do I have to make a globally shared module for importing the global setting and url details into site specific settings and urls.
I would like to make better reuse of the code rather than making redundant changes in each sites.
Please advice.
最满意答案
是的,这完全有可能。 这些网站甚至可以共享数据。
sites框架支持此功能 - 有关文档,请参见此处:
https://docs.djangoproject.com/en/1.11/ref/contrib/sites/
Yes, this is entirely possible. The sites can even share data.
The sites framework enables this - for documentation, see here:
https://docs.djangoproject.com/en/1.11/ref/contrib/sites/
更多推荐
发布评论