https://github.com/apryor6/flask_api_example
A demonstration of best practices for a large Flask API project
https://github.com/apryor6/flask_api_example
Last synced: 6 months ago
JSON representation
A demonstration of best practices for a large Flask API project
- Host: GitHub
- URL: https://github.com/apryor6/flask_api_example
- Owner: apryor6
- Created: 2019-05-18T15:20:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-09-01T11:24:34.000Z (almost 3 years ago)
- Last Synced: 2024-08-13T07:08:27.232Z (10 months ago)
- Language: Python
- Size: 289 KB
- Stars: 410
- Watchers: 13
- Forks: 97
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - apryor6/flask_api_example - A demonstration of best practices for a large Flask API project (Python)
README
# Example of a scalable Flask API

A sample project showing how to build a scalable, maintainable, modular Flask API with a heavy emphasis on testing.
_This is an example project using the structure proposed in [this blog post](http://alanpryorjr.com/2019-05-20-flask-api-example/)._
## Running the app
Preferably, first create a virtualenv and activate it, perhaps with the following command:
```
virtualenv -p python3 venv
source venv/bin/activate
```Next, run
```
pip install -r requirements.txt
```to get the dependencies.
Next, initialize the database
```
python manage.py seed_db
```Type "Y" to accept the message (which is just there to prevent you accidentally deleting things -- it's just a local SQLite database)
Finally run the app with
```
python wsgi.py
```Navigate to the posted URL in your terminal to be greeted with Swagger, where you can test out the API.
## Running tests
To run the test suite, simply pip install it and run from the root directory like so
```
pip install pytest
pytest
```