/uwsgi-ini

uWsgi config ini file for Falcon framework. Also example Falcon app are included to check configuration rapidly.

Primary LanguagePythonApache License 2.0Apache-2.0

Falcon and uWSGI

Falcon is faster than flask, uWSGi uWSGI is faster than Gunicorn. Test based on pceuropa/testing-rest-api

DIRECTORY STRUCTURE

  requirements.txt      pythons requirements packages 
  main.py               falcon app
  uwsgi.ini             contains config file needed to run app by uwsgi
  tests.py              tests based on pytest

REQUIREMENTS

  • Python 3+
  • pytest # to tests

INSTALATION

virtualenv -p python3 venv && source venv/bin/activate
pip3 install -r requirements.txt

CONFIGURATION

Configuration is in uwsgi.ini. Only Set proper patch and ready to run.

RUN

  1. Without uwsgi
python3 main.py
  1. With uwsgi but by command. Please run this command on path of application
uwsgi --http :8000 --wsgi-file main.py --callable app -H $(pwd)/venv/
  1. With uwsgi with help ini file. Good way to setup systemd
uwsgi uwsgi.ini

Tests

mytest test.py -v

Bonus

Nginx configuration

location / {
    proxy_pass       http://localhost:8000;
    proxy_set_header Host      $host;
    proxy_set_header X-Real-IP $remote_addr;
}

Stackoverflow topic