I am building a flask app on Elastic Bean Stalk. And after deploying I'm getting 500 Internal Server Error. When I checked the logs, I found that there was an error.
Traceback (most recent call last):
File "/opt/python/current/app/application.py", line 32, in <module>
application.run(debug=True, port=server_port, host='0.0.0.0')
File "/opt/python/run/venv/lib/python2.7/site-packages/flask/app.py", line 739, in run
run_simple(host, port, self, **options)
File "/opt/python/run/venv/lib/python2.7/site-packages/werkzeug/serving.py", line 617, in run_simple
test_socket.bind((hostname, port))
File "/usr/lib64/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 13] Permission denied
* Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
mod_wsgi (pid=6577): Target WSGI script '/opt/python/current/app/application.py' cannot be loaded as Python module.
mod_wsgi (pid=6577): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
The application.py file is as follows
from flask import Flask
application = Flask(__name__)
application.debug = True
# Application routes defined here
@application.route('/index')
def index():
return "Hello World!"
# Run the application
application.run(debug=True, host='0.0.0.0')
I tried a lot. I don't get what is happening. After reading other stackoverflow questions, I've found that this is caused by not having root permissions. How will I run my WSGI script with root permission in elastic bean stalk.
Aucun commentaire:
Enregistrer un commentaire