使用Django应用程序控制Apache VirtualHost可访问性

时间:2015-10-14 13:31:07

标签: python django apache

我正在开发一个嵌入式系统设备,它将托管不同的Django项目。所有这些都使用wsgi_mod机制部署,在这样的apache中使用VirtualHosts用于两个项目:

Listen 8080

<VirtualHost *:8080>
    DocumentRoot /home/fkrueger/testdjango/myproj
    <Directory /home/fkrueger/testdjango/myproj>
        Require all granted
    </Directory>
    WSGIScriptAlias / /home/fkrueger/testdjango/myproj/myproj/wsgi.py
    <Directory /home/fkrueger/testdjango/myproj/myproj>
    <Files wsgi.py>
        Require all granted
    </Files>
    </Directory>
</VirtualHost>


Listen 8081

<VirtualHost *:8081>
    DocumentRoot /home/fkrueger/testdjango/testdb/
    <Directory /home/fkrueger/testdjango/testdb/>
        Require all granted
    </Directory>
    WSGIScriptAlias / /home/fkrueger/testdjango/testdb/testdb/wsgi.py
    <Directory /home/fkrueger/testdjango/testdb/testdb/>
    <Files wsgi.py>
        Require all granted
    </Files>
    </Directory>
</VirtualHost>

第二个项目是否有可能控制wsgi_mod在apache运行时启动和停止某些托管项目。像应用程序处理程序。

我发现,在守护进程模式下运行wsgi_mod时,它会在更改wsgi.py文件时识别。我可以有一个模拟应用程序来避免启动Django项目。但我不想在运行时更改文件。

有更好的方法吗?

0 个答案:

没有答案