Skip to content

Best practices of how to setup a python flask web application or api

Notifications You must be signed in to change notification settings

jonnylangefeld/flask-base-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is the base sceleton for a Python Flask app

To use this sceleton, just

  • fork this repo
  • clone this repo
  • remove the parts not needed

Prerequisites:

  • docker is installed

Steps to run the app locally:

  1. Build the container locally: docker build -t my-flask-app .
  2. Run the container locally: docker run -it --rm -p 80:80 --name my-flask-app -v $(pwd)/app:/app my-flask-app
  3. Access the app via your browser: http://localhost

Testing:

pytest is ran from within the /app directory inside the container on build. The container build will not be successful if a test fails. For the test to be successful the build has to happen within Daimler's internal network and with the certificate in the /app directory.

The following screenshot helps to configure testing in pycharm:

Api Documentation:

Sample API request: GET /api/<string:variable>

This an endpoint of the api.

Endpoint: GET /api/<string:variable>

Return constraints:

{
    "name": String, 
    "data": {
        "age": Int,
        "height": String
    }
}

Return example:

{
    "name": "jonnylangefeld", 
    "data": {
        "age": 27,
        "height": "6 ft 5.5"
}

About

Best practices of how to setup a python flask web application or api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published