https://github.com/navapbc/template-application-flask
https://github.com/navapbc/template-application-flask
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/navapbc/template-application-flask
- Owner: navapbc
- License: apache-2.0
- Created: 2022-09-09T19:18:02.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-24T18:22:21.000Z (about 1 year ago)
- Last Synced: 2025-04-24T19:32:14.547Z (about 1 year ago)
- Language: Python
- Size: 2.32 MB
- Stars: 9
- Watchers: 31
- Forks: 5
- Open Issues: 40
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Open source tools for every layer of government service delivery.
Strata is a gold-standard target architecture and suite of open-source tools that gives government agencies everything they need to run a modern service.
# Template Application Flask
## Overview
This is a template application that can be used to quickly create an API using Python and the Flask framework. This template includes a number of already implemented features and modules, including:
* Python/Flask-based API that writes to a database using API key authentication with example endpoints
* PostgreSQL database + Alembic migrations configured for updating the database when the SQLAlchemy database models are updated
* Thorough formatting & linting tools
* Logging, with formatting in both human-readable and JSON formats
* Backend script that generates a CSV locally or on S3 with proper credentials
* Ability to run the various utility scripts inside or outside of Docker
* Restructured and improved API request and response error handling which gives more details than the out-of-the-box approach for both Connexion and Pydantic
* Easy environment variable configuration for local development using a `local.env` file
The template application is intended to work with the infrastructure from [template-infra](https://github.com/navapbc/template-infra).
## Installation
To get started using the template application on your project:
1. [Install the nava-platform tool](https://github.com/navapbc/platform-cli).
2. Install template by running in your project's root:
```sh
nava-platform app install --template-uri https://github.com/navapbc/template-application-flask .
```
3. Follow the steps in `/docs//getting-started.md` to set up the application locally.
4. Optional, if using the Platform infrastructure template: [Follow the steps in the `template-infra` README](https://github.com/navapbc/template-infra#installation) to set up the various pieces of your infrastructure.
## Note on memory usage
If you are using [template-infra](https://github.com/navapbc/template-infra),
you may want to increase the [default
memory](https://github.com/navapbc/template-infra/blob/main/infra/modules/service/variables.tf#L33)
allocated to the ECS service to 2048 Mb (2 Gb) to avoid the gunicorn workers
running out of memory. This is because the application is currently configured
to create multiple workers based on the number of virtual CPUs available, which
can take up more memory (see `//gunicorn.conf.py`).
## License
This project is licensed under the Apache 2.0 License. See the [LICENSE](LICENSE) file for details.
## Community
- [Code of Conduct](CODE_OF_CONDUCT.md)
- [Contributing Guidelines](CONTRIBUTING.MD)
- [Security Policy](SECURITY.md)