简体   繁体   English

django + wsgi +多个站点

[英]django + wsgi + multiple sites

I have a django-app using sites framework and need to deploy in a single apache virtual host. 我有一个使用站点框架的django-app,需要部署在一个apache虚拟主机中。 I was using mod-python with PythonInterpreter and it was working fine. 我正在使用mod-python和PythonInterpreter,它工作正常。 But mod-python is deprecated and I want to migrate to wsgi. 但是mod-python已被弃用,我想迁移到wsgi。 But I can figure out how to configure this scenario using wsgi. 但我可以弄清楚如何使用wsgi配置此场景。 Can anyone help me? 谁能帮我? I guess just using WSGIScriptAlias for each site is not working because it is running on same python interpreter. 我想只是为每个站点使用WSGIScriptAlias是行不通的,因为它在同一个python解释器上运行。

Can anybody help me? 有谁能够帮助我?

The default for WSGIApplicationGroup is %{RESOURCE} which expands to include the value of ServerName and the application mount point. WSGIApplicationGroup的默认值为%{RESOURCE},它扩展为包含ServerName的值和应用程序挂载点。 Thus each distinct virtual host would be in separate sub interpreter by default. 因此,默认情况下,每个不同的虚拟主机将位于单独的子解释器中。

This means that if you have multiple VirtualHost definitions with different ServerName setting then they would be distinct. 这意味着如果您有多个具有不同ServerName设置的VirtualHost定义,那么它们将是不同的。

In general though, it would be better to create a distinct daemon process group for each site and delegate each to a different set of processes. 但总的来说,最好为每个站点创建一个不同的守护进程组,并将每个进程组委派给不同的进程集。 This is done using WSGIDaemonProcess and WSGIProcessGroup directives. 这是使用WSGIDaemonProcess和WSGIProcessGroup指令完成的。

When each site is in a separate daemon process group, then often better to set WSGIApplicationGroup to %{GLOBAL} so using main interpreter in process as that avoids some issues with third party C extension modules for Python which aren't written so as to work in sub interpreters. 当每个站点都在一个单独的守护进程组中时,通常最好将WSGIApplicationGroup设置为%{GLOBAL},以便在进程中使用主解释器,因为这样可以避免使用Python编写的第三方C扩展模块的某些问题在副译员。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM