CICD/README.md

55 lines
1.0 KiB
Markdown
Raw Permalink Normal View History

2019-08-03 18:58:39 +02:00
# Example of a scalable Flask API
2019-08-26 14:35:09 +02:00
![The site](docs/site.png)
2019-05-18 19:00:13 +02:00
A sample project showing how to build a scalable, maintainable, modular Flask API with a heavy emphasis on testing.
2019-05-19 23:52:39 +02:00
2019-08-03 19:01:05 +02:00
_This is an example project using the structure proposed in [this blog post](http://alanpryorjr.com/2019-05-20-flask-api-example/)._
2019-08-03 19:00:42 +02:00
2019-05-19 23:52:39 +02:00
## 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.
2019-08-03 18:58:39 +02:00
2019-08-26 14:35:09 +02:00
2019-08-26 14:34:13 +02:00
2019-08-03 18:58:39 +02:00
## Running tests
To run the test suite, simply pip install it and run from the root directory like so
```
pip install pytest
pytest
2019-08-26 14:34:13 +02:00
```