4 months 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?
0 Replies
4 months ago
You can run your migration script in your start command
4 months 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
4 months ago
you can now run the migration command in the pre-deploy command!
4 months ago
Marking this as solved as migrations are the likely cause
4 months ago
!s
Status changed to Solved adam • 4 months ago