2 Djangos 1服务器

时间:2013-03-12 14:01:59

标签: django apache

我已经将我的几个项目部署到我的新服务器上。似乎正在发生的事情是我可以正常查看一个项目,但是一旦我转到下一个项目,前一个项目的设置仍在使用。

例如,jacobvalenta.net和dev.pawndaddy.org都是服务器上的项目,在两者之间翻转会导致设置混淆。

SGIPythonPath /home/projects/pawndaddy:/home/projects/jacobvalenta:/home/projects/sailcast:/home/projects/tryfecta:/home/projects/midiscribe

NameVirtualHost *:80

<VirtualHost *:80>
        ServerName jacobvalenta.net
        ServerAlias *.jacobvalenta.net

        DocumentRoot /home/projects/jacobvalenta
        WSGIScriptAlias / /home/projects/jacobvalenta/jacobvalenta/wsgi.py

        <Directory /home/projects/jacobvalenta/jacobvalenta>
                <Files wsgi.py>
                        Order deny,allow
                        Allow from all
                </Files>
        </Directory>
</VirtualHost>

<VirtualHost *:80>
        ServerName sailcast.org
        ServerAlias *.sailcast.org

        DocumentRoot /home/projects/sailcast
        WSGIScriptAlias / /home/projects/sailcast/sailcast/wsgi.py

        <Directory /home/projects/sailcast/sailcast>
                <Files wsgi.py>
                        Order deny,allow
                        Allow from all
                </Files>
        </Directory>
</VirtualHost>

<VirtualHost *:80>
        ServerName pawndaddy.org
        ServerAlias *.pawndaddy.org

        DocumentRoot /home/projects/pawndaddy/
        WSGIScriptAlias / /home/projects/pawndaddy/pawndaddy/wsgi.py

        <Directory /home/projects/pawndaddy/pawndaddy>
                <Files wsgi.py>
                        Order deny,allow
                        Allow from all
                </Files>
        </Directory>
</VirtualHost>

1 个答案:

答案 0 :(得分:0)

我应该多读一些文件了!

在wsgi.py中,评论说:

# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
# os.environ["DJANGO_SETTINGS_MODULE"] = "project.settings"

所以只需删除关于设置默认环境的行,所有内容都应该是好的。