简体   繁体   English

Flask UWSGI ModuleNotFound

[英]Flask UWSGI ModuleNotFound

I have a Flask application that I'm trying to configure for a production environment. 我有一个Flask应用程序,正在尝试针对生产环境进行配置。 So far, during testing python app.py inside of a virtualenv works fine. 到目前为止,在virtualenv内部测试python app.py期间运行良好。

However, I'm beginning to configure the application to begin using UWSGI. 但是,我开始将应用程序配置为开始使用UWSGI。 When I attempt to start the Flask app using 当我尝试使用启动Flask应用程序时

$ uwsgi -s /tmp/myapplication.sock --manage-script-name --mount /myapplication=app:app --virtualenv /path/to/my/venv

I get a 我得到一个

ModuleNotFoundError: No module named 'flask_httpauth' ModuleNotFoundError:没有名为“ flask_httpauth”的模块

I was wondering if anyone has experience w/ that authentication module and if they have any advice on what I should do. 我想知道是否有人具有该身份验证模块的经验,以及他们是否对我应该采取的措施有任何建议。 I'm unsure of why the development server starts without an issue, but the uwsgi server (that I pass the same virtualenv that's used for the dev server) runs into import issues 我不确定为什么开发服务器启动时不会出现问题,但是uwsgi服务器(我通过了与开发服务器相同的virtualenv)会遇到导入问题

I was able to resolve this issue by setting the home path to my virtualenv directory ( .venv in my case): 通过将home路径设置为我的virtualenv目录(在我的情况下为.venv ,我能够解决此问题:

# uwsgi.ini
home = /Users/floatingrock/Desktop/projects/google_v2/.venv/

If you're wondering, I got the full path using pwd . 如果您想知道,我可以使用pwd获得完整的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM