[英]Multiple django projects on apache [UPDATE]
After help, I have come to a proj.conf of this: 经过帮助,我来到了proj.conf:
<VirtualHost *:80>
WSGIScriptAlias /f_app /home/4rsenal/f_proj/f_proj/wsgi.py
ErrorLog ${APACHE_LOG_DIR}/error.log
CustumLog ${APACHE_LOG_DIR}/access.log combined
Alias /static/ /home/4rsenal/f_proj/static
<Directory /home/4rsenal/f_proj/static>
Require all granted
</Directory>
<Directory /home/4rsenal/f_proj/f_proj>
<Files wsgi.py>
Requier all granted
</Files>
</Directory>
WSGIProcessGroup f_proj
WSGIDaemonProcess f_proj python-home=/home/4rsenal/f_proj/f_projenv python-path=/home/4rsenal/f_proj
</VirtualHost>
<VirtualHost *:80>
WSGIScriptAlias /m_app /home/4rsenal/m_proj/m_proj/wsgi.py
ErrorLog ${APACHE_LOG_DIR}/error.log
CustumLog ${APACHE_LOG_DIR}/access.log combined
Alias /static/ /home/4rsenal/m_proj/static
<Directory /home/4rsenal/m_proj/static>
Require all granted
</Directory>
<Directory /home/4rsenal/m_proj/m_proj>
<Files wsgi.py>
Requier all granted
</Files>
</Directory>
WSGIProcessGroup m_proj
WSGIDaemonProcess m_proj python-home=/home/4rsenal/m_proj/m_projenv python-path=/home/4rsenal/m_proj
</VirtualHost>
With the new alias', if I type in http://[MYIPADDRESS]/f_app/f_app/ I'm good to go with that site, but if I type in http://[MYIPADDRESS]/m_app/m_app/ I get a Not Found error. 使用新别名”,如果我输入http:// [MYIPADDRESS] / f_app / f_app / ,则可以使用该网站,但如果我输入http:// [MYIPADDRESS] / m_app / m_app / ,出现未找到错误。 Why does one alias work but not the other?
为什么一个别名有效,而另一个别名无效? (I can fix the stupid looking urls later once I get these to both work).
(一旦我使它们都起作用,我便可以稍后修复愚蠢的网址)。
The basis of the problem if your configuration was accurate was that you had two VirtualHost
definitions but neither had a ServerName
. 如果您的配置正确的话,问题的基础是您有两个
VirtualHost
定义,但都没有ServerName
。 This meant name based host name matching couldn't be applied and so it would always use the first VirtualHost
. 这意味着无法应用基于名称的主机名匹配,因此它将始终使用第一个
VirtualHost
。
If you had intended them to be both under the same host name, the configuration should all be in the one VirtualHost
. 如果您希望它们都使用相同的主机名,则配置都应在一个
VirtualHost
。
This sort of problem along with others related to running multiple Django applications at the same time are explained in the blog post: 博客文章中介绍了此类问题以及与同时运行多个Django应用程序相关的其他问题:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.