项目作者: pceuropa

项目描述 :
uWsgi config ini file for Falcon framework. Also example Falcon app are included to check configuration rapidly.
高级语言: Python
项目地址: git://github.com/pceuropa/uwsgi-ini.git
创建时间: 2019-01-15T16:37:22Z
项目社区:https://github.com/pceuropa/uwsgi-ini

开源协议:Apache License 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

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

REQUIREMENTS

  • Python 3+
  • pytest # to tests

INSTALATION

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

CONFIGURATION

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

RUN

  1. Without uwsgi

    1. python3 main.py
  2. With uwsgi but by command. Please run this command on path of application

    1. uwsgi --http :8000 --wsgi-file main.py --callable app -H $(pwd)/venv/
  3. With uwsgi with help ini file. Good way to setup systemd

    1. uwsgi uwsgi.ini

Tests

  1. mytest test.py -v

Bonus

Nginx configuration

  1. location / {
  2. proxy_pass http://localhost:8000;
  3. proxy_set_header Host $host;
  4. proxy_set_header X-Real-IP $remote_addr;
  5. }

Stackoverflow topic