[Help] Django Google OAuth - Works locally but fails in prod with "django_session does not exist"
0xmstore
PROOP

a year ago

Hi! I'm having an issue with Google OAuth in my Django app.

Local vs Production behavior:

  • Locally: Google OAuth login works perfectly

  • Production: Getting a "relation 'django_session' does not exist" error

Technical details:

  • Django 5.1.4

  • social-auth-app-django 5.4.0

  • Using PostgreSQL database

  • Error occurs at: /social-auth/login/google-oauth2/

  • Full error: "relation 'djangosession' does not exist LINE 1: SELECT 1 AS 'a' FROM 'djangosession' WHERE 'django_session'…"

It seems the session tables aren't being created in the production database, despite working locally. I suspect this might be related to migrations not being run during deployment, but I'm not sure about the best way to handle this in Railway's environment.

Has anyone encountered this before?

Solved

8 Replies

0xmstore
PROOP

a year ago

5176d6ce-2430-490e-a7fe-936dd3567b94


0xmstore
PROOP

a year ago

this is exactly what i see when i try login with google auth in prod

1327573687506829300



adam
MODERATOR

a year ago

You can run your migration script in your start command



brody
EMPLOYEE

a year ago

you can now run the migration command in the pre-deploy command!


adam
MODERATOR

a year ago

Marking this as solved as migrations are the likely cause


adam
MODERATOR

a year ago

!s


Status changed to Solved adam about 1 year ago


Loading...