【发布时间】:2017-08-16 18:37:39
【问题描述】:
经过帮助,我来到了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>
使用新别名',如果我输入http://[MYIPADDRESS]/f_app/f_app/,我可以使用该站点,但如果我输入http://[MYIPADDRESS]/m_app/m_app/,我会收到未找到错误。为什么一个别名有效,而另一个别名无效? (我可以稍后修复看起来很愚蠢的网址,一旦我让这些网址都能正常工作)。
【问题讨论】:
-
您将它们都别名为根。 URL 的
/f_app和/m_app组件来自哪里?顺便说一句,您在Require all granted中有错字。 -
@Paulo Almeida 在我的 django 项目中。我的 f_proj/urls.py 包含来自 f_proj/f_app/urls.py 的 url。固定类型(不在实际的 conf 文件中)
-
好的,但是你必须改变你这样做的方式。如果你有不同的
WSGIScriptAliases 指向同一个地方,第一个将匹配,第二个将永远不会被看到。 -
您可以在您发布的链接中看到这一点。在第一个他们有不同的别名,在第二个他们在不同的端口上,在第三个他们专门讨论了这个问题,在 WSGIScriptAlias 指令的排序下。
-
有道理,唯一的事情是,如果我将 WSGIScriptAlias' 更改为不同的东西(比如说 fproj 和 mproj),还有什么需要改变的?问是因为如果我只是将空白 / 别名更改为 /mproj 他们现在指向不同的东西,那应该可以吗?我试过了,不行。
标签: django apache mod-wsgi wsgi