Closed jakubgs closed 4 years ago
It appears that django-admin
can fulfill the same role as python manage.py
:
/ # django-admin shell
Python 2.7.15 (default, Dec 21 2018, 03:51:20)
[GCC 6.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth.models import User
>>> User.objects.create_superuser('admin', 'admin@example.com', 'pass')
<User: admin>
I'd like to create the first superuser at setup time in order to later create all the checks and services using Ansible.
To figure out how to do that I've opened https://github.com/arachnys/cabot/issues/697 in which it turned out that:
django-admin createsuperuser
with won't work because1.11
does not supportDJANGO_SUPERUSER_PASSWORD
manage.py
script to run some Python won't work either because this image lacksmanage.py
As far as I'm concerned I just want a way to create a superuser with a password in a programmatic way so I can use the API without needing human intervention. The lack of
manage.py
makes this impossible.I was thinking of inserting the user directly into the PostgreSQL database, but for that to work I think I'd need to know the salt for the
pbkdf2_sha256
algorithm.