Home > Mobile >  How to solve this error deploying to render.com: django.db.utils.OperationalError: could not transla
How to solve this error deploying to render.com: django.db.utils.OperationalError: could not transla

Time:12-20

What I'm trying to do: Deploy my django app to render.com with a postgres database. I'm following the render guide: enter image description here

CodePudding user response:

I make the following and it work fine for me:

if DJANGO_ENV == 'development':
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
        }
    }
elif len(sys.argv) > 0 and sys.argv[1] != 'collectstatic':
    if os.environ.get('DATABASE_URL', None) is None:
        raise Exception('DATABASE_URL environment variable not defined')
    DATABASES = {
        'default': dj_database_url.config(conn_max_age=60, ssl_require=True)
    }
  • Related