12👍
I faced the similar problem. Then I created a superuser by running:
$ heroku run python manage.py createsuperuser
Then:
$ git push -f heroku master
$ heroku run python manage.py migrate
It worked all fine.
3👍
This worked for me:
heroku run python manage.py createsuperuser -a <app_name>
After creating the superuser, refresh your app
& make sure to use a first capital letter in the username section like "Raj" instead of "raj".
Edit:-
Added the -a flag in front of <app_name>, without which heroku will throw an error
1👍
I am facing similar error, but however I have noticed few things in your settings.py I feel should be changed, when you are migrating to heroku the default database needs to be changed to postgresql like this
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'mydatabase',
'USER': 'mydatabaseuser',
'PASSWORD': 'mypassword',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
You will find these credentials in your Heroku App’s Resources tab->add-ons->postgresql->view credentials.
Refer to these links for detailed information:
https://docs.djangoproject.com/en/1.11/ref/settings/#std:setting-DATABASES
This link tells you how to separate local_settings from settings:
https://djangogirls.gitbooks.io/django-girls-tutorial-extensions/heroku/
Hope this helps!
0👍
Maybe this will help someone else.
After some thorough search on the net, I had still the issue and could not login into the admin page in production.
Therefore , I had to come up with a workaround.
I created a new user in my local environment (checked if I could log in with it on localhost, and it worked), copied the sqlite file located in the app folder,which is called db.sqlite3 , and copied it onto the production server in the same location.
Restarted the app, and i was able to login.
I came up with this after i saw on the command line that the user i just created did not exist.
heroku run python /app/src/manage.py changepassword -a appname
which returned:
CommandError: user 'yourusername' does not exist
- Django query how to write: WHERE field LIKE '10__8__0__'?
- Can i use celery without django
- How to execute file.py on HTML button press using Django?
- How do I make Django-Piston to include related child objects in the serialized output?
- Celery immediately exceeds memory on Heroku