0

I deployed a flask SocketIO application using uwsgi server in Ubuntu 16.04.I will be getting my original app instance from a script wsgi.py

from server import app

if __name__ == "__main__":
     app.run()

And in a separate virtual environment I installed all the dependencies required for my project and intended to run my application through a configuration file myproject.ini which will be activated by a service in /etc/systemd/system

Here's the configuaration file myproject.ini

[uwsgi]
module = wsgi:app

master = true
processes = 5
socket = myproject.sock
chmod-socket = 660
vacuum = true
die-on-term = true

And here's the myproject.service file

[Unit]
Description=uWSGI instance to serve myproject
After=network.target

[Service]
User=user
Group=www-data
WorkingDirectory=/home/user/myproject
Environment="PATH=/home/user/myproject/virtual_frame/bin"
ExecStart=/home/user/myproject/virtual_frame/bin/uwsgi --ini myproject.ini

[Install]
WantedBy=multi-user.target

When I run the application with the default wsgi server of flask then it's working fine

enter image description here

But, when I am trying to run the application with uwsgi server which I configured then I am getting the following error

enter image description here

As gevent doesn't work in python3, so I am assuming that the uwsgi server is running the application in python3 enviroment

Therefore, I am interested to know the configuration to force uwsgi to work in python instead of python3

And here's the status of the project:-

enter image description here

Espoir Murhabazi
  • 5,973
  • 5
  • 42
  • 73
S.Rakin
  • 812
  • 1
  • 11
  • 24
  • are you using heruku? I have a working solution for that hosting platform – Espoir Murhabazi Feb 01 '18 at 10:25
  • No. I am not using heroku.. I will be using my Ubuntu server for hosting. But, you could share your solution with hope – S.Rakin Feb 01 '18 at 11:12
  • check it here : https://devcenter.heroku.com/articles/python-runtimes#supported-python-runtimes – Espoir Murhabazi Feb 01 '18 at 11:36
  • and another useful ressource may be is here : https://forum.predix.io/articles/24718/how-to-specify-a-python-version-for-your-app.html – Espoir Murhabazi Feb 01 '18 at 11:37
  • Did you look at the [Flask-SocketIO documentation](https://flask-socketio.readthedocs.io/en/latest/#uwsgi-web-server) with regards to how to deploy with uWSGI? You don't appear to be following that as a guide. – Miguel Grinberg Feb 02 '18 at 05:45

0 Answers0