0

我想用多个主机名运行多个 django 项目。

如果使用来自 www.momsy.org,则转到 /var/web/momsy.git.org 其他如果来自 www.momsy.net,则转到 /var/web/momsy.git.net

这是为了记录和分析他/她来自哪里。

因此,以下不起作用,因为 [WSGIPythonPath 不能出现在部分内]。

但我不能使用 http.conf 因为我需要“服务器名”变量。

我怎么解决这个问题?


ServerAdmin webmaster@localhost
服务器名 www.momsy.org

    WSGIScriptAlias / /home/web/momsy.git.kr/momsy/wsgi.py                             
    WSGIPythonPath /home/web/momsy.git.kr                                              

    <Directory  /home/web/momsy.git.kr/momsy>                                          
    <Files wsgi.py>                                                                    
            Order deny,allow                                                           
            Allow from all                                                             
    </Files>                                                                           
    </Directory>                                                                       

一种

4

1 回答 1

1

使用守护进程模式,将每个 Django 实例委托给一组单独的进程,并根据每个守护进程组的需要设置 python-path。看:

否则在 WSGI 脚本文件中设置 sys.path,而不是在 Apache 配置中。

于 2012-12-29T09:57:24.460 回答