adamdoty / homebaker

A baked-goods, birthday-treat, tracking app I made for my wife.
3 stars 0 forks source link

[deployment] postgres #56

Open bbelderbos opened 1 year ago

bbelderbos commented 1 year ago

We use python-decouple to load in env variables and dj-database-url to just work with a single DB URL, e.g.

DATABASE_URL=postgres://postgres:password@0.0.0.0:5432/my_db

You can already swap to a postgres db locally to have your dev environment as closely matching to production. Example how we use dj-database-url in settings.py for the DB config:

import dj_database_url
...

DATABASES = {
    'default': dj_database_url.config(
        default=config('DATABASE_URL')
    )
}
adamdoty commented 1 year ago

Using this as a guide: https://www.youtube.com/watch?v=wGEZWXiEnNI

adamdoty commented 1 year ago

pycharm database configuration not working - https://www.youtube.com/watch?v=r90CNlorK78

adamdoty commented 1 year ago

I made a postgres db in aws, but haven't been able to connect to it yet.

adamdoty commented 1 year ago

switching to deployment using elastic beanstalk - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html

adamdoty commented 1 year ago

following this https://faun.pub/how-to-create-cicd-using-github-as-source-and-elastic-beanstalk-244319a2a350

bbelderbos commented 1 year ago

Hm let's look at this later, can you try to use postgres from the command line so not coupled with Pycharm?