我在webapp上工作了4个月,当我尝试部署它时,我在服务器上看到了这条消息。
回溯(最近一次调用最后一次):文件“/srv/data/web/vhosts/default/wsgi.py”,第12行,从FlaskApp导入应用程序作为应用程序文件“./FlaskApp/init.py”,第3行,在来自flask导入Flask,render_template ModuleNotFoundError:没有名为'flask'的模块
还有这条线我不明白:
!没有内部路由支持,用pcre支持重建!!!
所以,我有requirements.txt和wsgi.py,我是否有用脚本或其他东西激活的东西?因为我觉得venv没有在服务器上激活..?
您的错误告诉您没有安装flask。
您可以看到已安装的软件包:
pip list
使用您的requirements.txt安装:
pip install -r requirements.txt
单独安装烧瓶:
pip install flask
确保你的wsgi正在调用正确的python可执行文件,如果你使用virtualenv,你需要设置完整的路径到你的wsgi配置。
!!! no internal routing support, rebuild with pcre support !!!
此错误是因为您需要libpcre,您可以像这样安装它:
apt-get install libpcre3 libpcre3-dev -y
然后重新安装uwsgi
pip uninstall uwsgi
pip install uwsgi --no-cache