Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create superuser Django in PyCharm

I'm following the basic tutorial but for some reason any time I try to create a superuser (run manage.py Task --> createsuperuser) I get an error in the program.

It returns "Superuser created." but after giving me this error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: cannot import name 'setup_environ'

When I try to login to 127.0.0.1:8000/admin

I get incorrect credentials. Any thoughts?

As of now all I have are django installed through pycharm and python 3.4 and django 1.7.

like image 555
tryingtolearn Avatar asked Sep 30 '14 23:09

tryingtolearn


2 Answers

Well it looks like it is a bug in pycharm 4.3.1 and python 3.4 and django 1.7I faced the same problem and after searching for a while, I managed to solve the issue through using the command line. In the command line type:

$python manage.py createsuperuser

then it will ask you for username, type that and press enter. Notice that you might not be able to use the username you used while trying to create the superuser the first time

then enter an email

and a password and reenter the password while entering the password, you will notice it is hiding it and not moving the cursor, don't think it is not getting what you type Then you're done.

The reason why you can't use the username from first time is that Django might have created a superuser using that username but it missed up with the password or sth as the discussion from this thread suggests, however, I am not sure of that.

like image 174
A_Matar Avatar answered Sep 19 '22 14:09

A_Matar


Go to cmd or if you are in pycharm, go to Terminal. paste it:

python manage.py createsuperuser

Then, follow instructions in terminal. all set. Now inside terminal,paste it:

python manage.py runserver

after clicking that local server, add /admin in url. in my case:

http://127.0.0.1:8000/admin

Give your username and password,it will redirect you to Django administration page.
upvote if it works...

like image 24
Abdullah Al Masum Avatar answered Sep 18 '22 14:09

Abdullah Al Masum