ianvaernet / flask

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flask

Overview

This apps uses swagger-codegen and the Connexion library on top of Flask.

Requirements

To set up the project:

Start by setting up the git pre commit hook that will run all the tests and format your code

make set-pre-commit

Usage

To run the server, execute the following from the root directory:

make build-container # this will build our custom python container
make up

and open your browser here:

http://localhost:8080/v1/ui/

To launch the integration tests:

make test

To connect to the database instance:

make mysql

To generate a database migration (after execute the command, restart the container to run the migration):

make migrate Some explanation message

To merge database migrations (2 or more migrations generated in different branches have the same down_revision)

make merge-migrations Some explanation message

To install dependencies use:

make pip ${package}

To freeze the dependencies use:

make freeze

To regenerate the source code:

make swagger-gen

Add attributes to a response object:

# import the mutable_response function
# This will let you create MutableRespose
from swagger_server.formatter import mutable_response

response = mutable_response(auth_response)

# Now we can call the append method as many times as we want to append new data
response.append('key', 'value').append('test', 'test_value')

then we can just return this response as it was done with any other

Documentation only

Requirements

To render locally the documentation markdown we use grip

grip docs/4+1_architectural_view.md

To generate the class diagrams and the package diagram we use a tool called pyreverse.

This tool comes with the package pylint and requires graphviz

pyreverse -o png -p cms-nft-minting swagger_server

About


Languages

Language:Python 99.6%Language:Makefile 0.3%Language:Mako 0.1%Language:Dockerfile 0.0%