×



The blog will guide you on how to set up django super user in a django app hosted on heroku.

This blog will also help on how to open heroku exisiting app in a project.

Overview :

I have a django app already hosted on heroku and now i have to create a super user which is important as using super user you can view the data present in your hosted apps database.

Sadly i deleted the app from my PC. So now i have to do an extra step of cloning the project and opening the existing heroku app in it.

So lets get started :)

STEP 1 : cloning REPO and OPENING existing heroku app in it

Skipping cloning step.

Lets dive directly into my folder.

First type

heroku To check if you have already installed installed heroku on your PC

Next, you need to login

heroku login

**The important step of opening existing heroku app : **

heroku git:remote -a PROJECTNAME

STEP 2 : Open heroku BASH of your app through CLI

To create a super user for your django app, we first need to access the hosted app through CLI which is done through heroku bash.

This is basically opening a your apps folder though terminal so that you can access it.

It is done by :

heroku run bash --app PROJECTNAME

STEP 3: Final step is to create a superuser

If you would have done the previous step, then now you will be in the bash with access to your hosted apps file.

Now, create super user by :

python manage.py createsuperuser

after typing this you will be creating a user by entering name, email and password.

Thats all xD.

now you can exit the bash by typing :

exit

Lets enter now

Hit in the URL : yourherokuappURL.com/admin

and type in the user details created before.

Congratulations you are all set now!!





Read More







Vansh Kapoor

Having expertise in full stack development and app development. Currently working in Thoughtworks as Application Developer Consultant on amazing production applications and processes.