Fly.io django and postgres deploy

35 Views Asked by At

I'm trying to deploy my django app in Fly.io with postgreSQL database, so I've followed de docs to attach my app with the postgres cluster with the main app.

I’ve generated the DATABASE_URL like this:

flyctl pg attach ac7-postgres
Checking for existing attachments
Registering attachment
Creating database
Creating user

Postgres cluster ac7-postgres is now attached to ac7
The following secret was added to ac7:
DATABASE_URL=postgres://ac7:<'PASSWORD'>@ac7-postgres.flycast:5432/ac7?sslmode=disable

So I have this code in settings.py:

os.environ['DATABASE_URL'] = 'postgres://ac7:<PASSWORD>@ac7-postgres.flycast:5432/ac7?sslmode=disable'

DATABASES = {
    'default': dj_database_url.config(default=os.getenv('DATABASE_URL'))
}

but when I try “py manage.py makemigrations” it shows:

UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xe3 in position 76: invalid continuation byte

Can someone help me? Please

0

There are 0 best solutions below