Helper functions to run Django and Flask applications in AWS Copilot/ECS.
Project description
DBT Copilot Python
A set of utility functions for running Django & Flask apps in AWS ECS via AWS Copilot.
Using dbt-copilot-python
Installation
pip install dbt-copilot-python
Usage
In settings.py
...
ALLOWED_HOSTS
Add the ECS container IP to ALLOWED_HOSTS
so that the Application Load Balancer (ALB) healthcheck will succeed:
from dbt_copilot_python.network import setup_allowed_hosts
ALLOWED_HOSTS = [...]
ALLOWED_HOSTS = setup_allowed_hosts(ALLOWED_HOSTS)
DATABASES
To configure the DATABASES
setting from an RDS JSON object stored in AWS Secrets Manager, there are two options.
-
Configure the
DATABASES
setting to use a database URL (recommended):Note: This is dependent on the
dj-database-url
package which can be installed viapip install dj-database-url
.import dj_database_url from dbt_copilot_python.database import database_url_from_env DATABASES = { "default": dj_database_url.config( default=database_url_from_env("DATABASE_ENV_VAR_KEY") ) }
-
Configure the
DATABASES
setting to use a dictionary containing the settings:from dbt-copilot-python.database import database_from_env DATABASES = database_from_env("DATABASE_ENV_VAR_KEY")
Contributing to dbt-copilot-python
Requirements
- Poetry;
pip install poetry
Install dependencies & pre-commit hooks
poetry install && poetry run pre-commit install
Run the tests
poetry run pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dbt_copilot_python-0.1.3.tar.gz
.
File metadata
- Download URL: dbt_copilot_python-0.1.3.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d06ab9d12326ecd9fb017ef21c154bc51fc2f46cff19841e4f24b920f123afa |
|
MD5 | 26d1dd6c0be05a9d051e9170edc98357 |
|
BLAKE2b-256 | 1895234b7eba26c9309506b43d2abacd37a24ca1b5fc9dd2e8ef87518b684793 |
File details
Details for the file dbt_copilot_python-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: dbt_copilot_python-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2dbb891af58889d578130f810efad86c947525fb61c6315bf0253f6d9297b00 |
|
MD5 | d544e64f778933d4a6563221865bbf62 |
|
BLAKE2b-256 | 9409c31d1cd2a07036b9cb0df82ef586c82f655eba18502dbf0182e96d32026b |