[英]Apache2 and Flask issue
I try to load my app towards my apache2 server but i keep getting error 500.我尝试将我的应用程序加载到我的 apache2 服务器,但我不断收到错误 500。
File Structure: /var/www/ApproveAndPost:文件结构:/var/www/ApproveAndPost:
/var/www/ApproveAndPost/ApprovePost_Web: /var/www/ApproveAndPost/ApprovePost_Web:
Files content: /etc/apache2/sites-available/ApproveAndPost.conf文件内容:/etc/apache2/sites-available/ApproveAndPost.conf
<VirtualHost *:80>
ServerName 192.168.170.67
ServerAdmin email@mywebsite.com
WSGIScriptAlias / /var/www/ApproveAndPost/ApproveAndPost.wsgi
<Directory /var/www/ApproveAndPost/ApprovePost_Web/>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/ApproveAndPost/ApprovePost_Web/static
<Directory /var/www/ApproveAndPost/ApprovePost_Web/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
WSGI File: WSGI 文件:
#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/ApproveAndPost")
from ApproveAndPost import app as application
application.secret_key = 'DISISSECRETKEY'
Python Code: Python 代码:
run.py运行.py
from ApprovePost_Web import app
if __name__ == "__main__":
app.run(debug=True)
init .py:初始化.py:
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SECRET_KEY'] = '#$%^&*'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///site.db'
db = SQLAlchemy(app)
from ApprovePost_Web import routes
if __name__ == "__main__":
app.run(debug=True)
I think i am mixing up a couple of things?我想我混淆了几件事?
The problem is essentially that you are installing Flask, and possibly other required libraries, in a virtual environment but the python (wsgi interface) is running with the system python which does not have these extra libraries installed.问题本质上是您在虚拟环境中安装 Flask 以及可能需要的其他库,但 python(wsgi 接口)与系统 python 一起运行,该系统没有安装这些额外的库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.