Django - gunicorn on App Engine. Error: 'No Module Named my_project'

故事扮演 提交于 2019-12-08 04:05:36

问题


I'm trying to upload my Django(v2.0) application to Google App Engine, but Gunicorn(v19.7.1) can't find my app. When I deploy my app using gcloud app deploy I get error

'No Module Named AppFlex'

Full screenshot of the error and app.yaml config is below.

The contents of the wsgi.py are:

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "AppFlex.settings")

application = get_wsgi_application()

Additionally, I can run the app locally using:

gunicorn AppFlex.wsgi --workers 16

Another screenshot where I can run the app using gunicorn locally :


回答1:


I think the issue is that your top level module (AppFlex) is camel-cased, and for some reason App Engine expects only lower case module names.

If you change your module name to appflex and update the corresponding configuration in app.yaml and everywhere else that your top level module is referenced (e.g., in wsgi.pi) it should work.

I am not too sure why App Engine is doing that, but it is convention for modules to be lower case, and I'd strongly suggest you follow that convention.



来源:https://stackoverflow.com/questions/47836949/django-gunicorn-on-app-engine-error-no-module-named-my-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!