Skip to content

marcszy91/flask-restx-boilerplate

Repository files navigation

flask-restx-boilerplate

The flask-restx-boilerplate allows you to create fast a Flask API application.

Besides that there is an How-To for beginners in the Wiki, which explains step by step how to add a new API Endpoint

The code is mainly based on the following repo cosmic-byte/flask-restplus-boilerplate and a little bit from antkahn/flask-api-starter-kit

There are the following differences in the repositories aboth:

  • The tutorials are a little bit outdated and work no longer correctly
  • The package versions are outdated and no longer match the tutorial
  • This repository combines the best of both (for my understanding)
  • Use Flask CLI instead of manager (nativ)
  • Use no makefiles (All os friendly)

Development

Python 3.9 Code style: black Linter: flake8 Changelog: keepachangelog Versioning: Semantic Versioning 2.0.0

Build state

Workflow

Install / Quickstart

Dependencies

Local dependencies

python 3.9.10

Full How-To

Wiki How-To

Quickstart

setup project

  1. clone this repository

    git clone https://github.com/Ezak91/flask-restx-boilerplate
  2. change to directory

    cd flask-restx-boilerplate
  3. creat venv

    # windows
    py -3 -m venv .venv
    
    # on linux/mac
    python3 -m venv .venv
  4. activate venv

    # windows
    .venv\scripts\activate
    
    # on linux/mac
    source .venv/bin/activate
  5. install requirements

    # for developing
    pip install -r requirements-dev.txt
    # only run
    pip install -r requirements.txt
  6. setup flask application

    # bash (linux, mac)
    export FLASK_APP=run
    # bash (windows)
    set FLASK_APP=run
    # powershell (windows)
    $env:FLASK_APP = "run"
  7. setup database

    flask db init
    flask db migrate -m "Initial migration."
    flask db upgrade

run flask

  1. setup flask application

    # bash (linux, mac)
    export FLASK_APP=run
    # bash (windows)
    set FLASK_APP=run
    # powershell (windows)
    $env:FLASK_APP = "run"
  2. run flask application

    flask run
  3. Now you can open the following url in your browser to see the swagger ui page

    http://127.0.0.1:5000
    

About

A boilerplate for an flask rest api

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published