Search code examples
pythondjangoheroku

Why does my Django login work on development server but not production server?


I have an issue where I can login to Django via my development server but it will not work on the production server. I am using Heroku to deploy. All the pages work correctly but I can't login to my Django database.


Solution

  • Your user credentials are stored in your database. If you have a different database Server in Production which is hosted online it won’t have the credentials stored that you have in your local development database.

    So you basically have to get into your deployed Django app using ssh or so and run „createsuperuser“ there again. Alternatively you could copy the user credentials from you local database and push them to your production database; but just creating new ones will probably be easier if you don’t have to deal with a lot of users.

    If you were using Django with „default settings“ it is using an SQLite file (= database). In Production for a Webapp hosted online it will be most likely a „real database server” (DBMS) like PostgreSQL or MySQL or so as SQLite is fine for development and testing, but struggles with concurrent user access to data.