I am currently having an issue running a Flask application using flask-socketio with eventlet. When I push to AWS without eventlet my application works perfectly. This is great, however I want my application to be production ready and running flask-socketio without eventlet is slow and tedious. What I did was I broke down my application into a smaller flask application with the bare minimum requirements and code in order to test out what exactly is wrong(A link to this application is available below). This smaller application works on aws if you get rid of eventlet and it's dependencies in requirements.txt and will break if you leave them in there. After a lot of debugging and testing I still can not figure out where the source of the error comes from. Any help would be much appreciated.
On AWS I receive the following generic server error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
And in the AWS eb logs I see the following:
[Fri Feb 16 17:45:47.269584 2018] [:error] [pid 4233] import re
[Fri Feb 16 17:45:47.269592 2018] [:error] [pid 4233] File "/opt/python/run/venv/lib64/python3.6/re.py", line 142, in <module>
[Fri Feb 16 17:45:47.269750 2018] [:error] [pid 4233] class RegexFlag(enum.IntFlag):
[Fri Feb 16 17:45:47.269762 2018] [:error] [pid 4233] AttributeError: module 'enum' has no attribute 'IntFlag'
[Fri Feb 16 17:45:48.274188 2018] [:error] [pid 4233] [remote 127.0.0.1:148] mod_wsgi (pid=4233): Target WSGI script '/opt/python/current/app/application.py' cannot be loaded as Python module.
[Fri Feb 16 17:45:48.274233 2018] [:error] [pid 4233] [remote 127.0.0.1:148] mod_wsgi (pid=4233): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
Here’s the github repo that contains my project code:
https://github.com/Freddie-Pike/Flask-SocketIO-AWS
EDIT: This setup works on localhost. It just does not work on AWS.