'python manage.py createsuperuser' error

Question:

The ‘python manage.py createsuperuser’ command gives me this error:

Superuser creation skipped due to not running in a TTY. You can run manage.py createsuperuser in your project to create one manually.

Looking through the source, namely createsuperuser.py, it catches the NotRunningInTTYException:

except NotRunningInTTYException:
    self.stdout.write(
        "Superuser creation skipped due to not running in a TTY. "
        "You can run `manage.py createsuperuser` in your project "
        "to create one manually."
    )

Anyone know how I can resolve this error? if it makes any difference, my installation process was a headache… getting ‘python manage.py runserver’ took me a good day. Maybe I don’t have things configured properly… Using Windows.

Asked By: Lansana Camara

||

Answers:

I believe you tried to run this inside an IDE or some other environment which is not a TTY. Django expects the command to be run from a TTY compatible shell.

Run the command on your Windows command prompt, outside your editor/IDE. It should work.

To know more about TTY:

Answered By: masnun

For Windows CMD console you should do this steps (if you use virtual environment):

  1. c:Path_to_you_AppvenvScriptsactivate
  2. (venv) cd c:Path_to_you_App
  3. (venv) c:Path_to_you_App>python manage.py createsuperuser
Answered By: Andrey Zinovich

You can create super user using:

winpty python manage.py createsuperuser
Answered By: Divyrajsinh
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.