Skip to main content

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.

  1. Configure the DATABASES setting to use a database URL (recommended):

    Note: This is dependent on the dj-database-url package which can be installed via pip 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")
        )
    }
    
  2. 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

Install dependencies & pre-commit hooks

poetry install && poetry run pre-commit install

Run the tests

poetry run pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbt_copilot_python-0.1.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

dbt_copilot_python-0.1.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file dbt_copilot_python-0.1.2.tar.gz.

File metadata

  • Download URL: dbt_copilot_python-0.1.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.2 Darwin/22.5.0

File hashes

Hashes for dbt_copilot_python-0.1.2.tar.gz
Algorithm Hash digest
SHA256 76ca660b2e4b2c6e942598f1bfa8d8e481891de7bf3324f506603737d3d6cc10
MD5 8e2ec12dee8fa5ab31989731896a8c3f
BLAKE2b-256 743fd21c9b67842b708facba9ec3635e4ec5591a06f871f1f804e466bd22660c

See more details on using hashes here.

File details

Details for the file dbt_copilot_python-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for dbt_copilot_python-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 38e98f009b1a1a458a9b28bc12f897a964da185b632d25925f6cd48b572666d2
MD5 47068e84832ecf6a647fe811bd30a0d6
BLAKE2b-256 0eb1bc867cfa23dc4007d831f72986f44473a45d099ad88144ba47f11c77a2ce

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page