Giter VIP home page Giter VIP logo

flight_tools's Introduction

minimal-flask-api

This template repository provides a minimal configuration for a 'production-ready' Flask API project. It includes a basic project structure and 'seed' files for functional and non-function testing, a basic application structure (including error-handling blueprint), and a few assorted 'getting started' files too.

The template has been set up for use with Python >= 3.7 and Docker.

Running locally

To run the basic server, you'll need to install a few requirements. To do this, run:

pip install -r requirements/common.txt

This will install only the dependencies required to run the server. To boot up the default server, you can run:

bash bin/run.sh

This will start a Gunicorn server that wraps the Flask app defined in src/app.py. Note that this is one of the recommended ways of deploying a Flask app 'in production'. The server shipped with Flask is intended for development purposes only.

You should now be able to send:

curl localhost:5000/health

And receive the response OK and status code 200.

Running with docker

Unsurprisingly, you'll need Docker installed to run this project with Docker. To build a containerised version of the API, run:

docker build . -t flask-app

To launch the containerised app, run:

docker run -p 5000:5000 flask-app

You should see your server boot up, and should be accessible as before.

Developing with the template

To develop the template for your own project, you'll need to make sure to create your own repository from this template and then install the project's development dependencies. You can do this with:

pip install -r requirements/develop.txt

This'll install some style formatting and testing tools (including pytest and locust).

flight_tools's People

Contributors

asturgeon123 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.