项目作者: leafarz

项目描述 :
Flask rest boilerplate project with multiple API version support via swagger
高级语言: Python
项目地址: git://github.com/leafarz/flask_boilerplate.git
创建时间: 2020-04-14T14:03:30Z
项目社区:https://github.com/leafarz/flask_boilerplate

开源协议:

下载


Flask-Boilerplate

Flask boilerplate project with multiple API version support.
img

Setup

  1. In root directory, create an environment variable and activate
    1. python -m venv venv
    2. venv\Scripts\activate
  2. Install packages
    1. pip install -r requirements.txt
  3. In src, create a .env file and add
    1. FLASK_ENV=dev # or prod
    2. SECRET_KEY=SECRET_KEY

Running

  1. In src, do migrations
    1. python manage.py db init
    2. python manage.py db migrate
    3. python manage.py db upgrade
  2. Run server
    1. python manage.py runserver
  3. Open http://127.0.0.1:5000/ and it should show the Swagger-UI. This is disabled in prod environment.

Deployment

  • Heroku
    1. Create heroku app
    2. Update config with the Postgres URL from Heroku
    3. Initialize, migrate and upgrade the database
    4. Set the environment variables in Heroku
    5. Deploy the app