我的Doucment根设置为"/var/www/html“,我需要它位于"/var/www/cl”
我已经设置了我的/etc/apache2/sites available/cl.conf,如:
<VirtualHost *:80>
ServerName <my IP is here already>
ServerAdmin <my email here already>
WSGIScriptAlias / /var/www/cl/cl.wsgi
DocumentRoot /var/www/cl
<Directory /var/www/cl/cl/>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/cl/cl/static
<Directory /var/www/cl/cl/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>我的cl.wsgi:
#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/cl/")
from cl import app as application
application.secret_key = '<already changed this>'我的目录结构如下
var/
www/
cl/
cl/
/static/
/templates/
/__init__.py
cl.wsgi非常感谢!如果你需要更多信息就告诉我。
最新情况:
现在我已经将文档根目录更改为var/www,但是现在的问题是它没有执行我的cl.wsgi,所以网站只显示我的目录。
解决方案:一位开发人员朋友通过与我一起访问我的服务器帮助我,我们发现我一直在安装apache和wsgi,就像int一样,我看的教程是:
sudo apt-get install libriache2-mod-wsgi python-dev
但应该是:
sudo apt-获取安装libriache2-mod-wsgi py3
它解决了一切。谢谢你们!
发布于 2021-12-16 07:23:29
解决方案:一位开发人员朋友通过与我一起访问我的服务器帮助我,我们发现我一直在安装apache和wsgi,就像int一样,我看的教程是:
sudo apt-get install libriache2-mod-wsgi python-dev
但应该是:
sudo apt-获取安装libriache2-mod-wsgi py3
它解决了一切。但这取决于python烧瓶的版本。所以这对我有用。谢谢!
https://stackoverflow.com/questions/70354390
复制相似问题