Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
How can I a Djanog auth user on the command line and not have to manually enter the password?

I'm using Django 3.2 and the auth module. I would like to create a super user on the command line (for eventual inclusion in a docker script). When I try this

$ python manage.py createsuperuser --username=joe --email=joe@example.com

I'm prompted for a password. The module does not seem to support a "--password" argument ...

$ python manage.py createsuperuser --username=joe --email=joe@example.com --password=password
usage: manage.py createsuperuser [-h] [--username USERNAME] [--noinput] [--database DATABASE]
                                 [--email EMAIL] [--version] [-v {0,1,2,3}] [--settings SETTINGS]
                                 [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color]
                                 [--skip-checks]
manage.py createsuperuser: error: unrecognized arguments: --password=password

Is there a way I can auto-create a user without manual intervention?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This is done for security reasons: usually shell command are written to a history file, and if you thus would pass the password as parameter, a hacker could eventually look at the history and thus obtain the password of the superuser. It can read the content of the DJANGO_SUPERUSER_PASSWORD variable to set the password.

You thus can set the password with:

DJANGO_SUPERUSER_PASSWORD=somepassword python manage.py createsuperuser --no-input --username=joe  --email=joe@example.com

I would however strongly advise not to set the DJANGO_SUPERUSER_PASSWORD in the script file, but define the environment variable elsewhere.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!