简体   繁体   中英

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.

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.

If you are configured different database in your production server you have to execute migrations and createsuperuser. Then you'll able to login.

Your current user credentials are saved in your database which is configured in local server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM