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?
8 Replies
a year ago
You can run your migration script in your start command
a year ago
Start command docs: https://docs.railway.com/reference/build-and-start-commands
May be relevant: https://docs.railway.com/guides/django#set-up-database-migrations-celery-beat-and-celery
a year ago
you can now run the migration command in the pre-deploy command!
a year ago
Marking this as solved as migrations are the likely cause
a year ago
!s
Status changed to Solved adam • about 1 year ago
