Target WSGI script not found or unable to stat

匿名 (未验证) 提交于 2019-12-03 08:44:33

问题:

Target WSGI script not found or unable to stat: /opt/python/current/app/application.py

I contain my app in a file called application.py, and my application's configuration looks like this:

I also tried uploading the sample app that AWS provides, which only contains 'application.py`, and yet I still get this error.

What could be causing the error?

回答1:

I had a similar issue. You should put your application.py in root directory as your WSGIPath suggests, or change your WSGIPath in .elasticbeanstalk/optionsettings.yourappname-env.



回答2:

For me, I had my app instance stored in a variable called app, which wasn't recognised by Elastic Beanstalk. As soon as I changed the variable to application, it started working.

# In application.py or manage.py, after initialising the app application = app 

should do the trick.



回答3:

Use application instead of app or any other variable you are using.

application = Flask(__name__) 


回答4:

For me, it was this silly thing. In my mac, I compressed by right-clicking on the folder/repository and compressing it to zip. However, a zip like that extracts to open another folder within it which contains the application. As a result, EBS is unable to locate application.py. The simple fix hence was to select all the individual files inside the folder to create the zip file for uploading (or using the EB CLI to upload).



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