Skip to content

Commit 33b0c50

Browse files
committed
automated create superuser
1 parent f8389a3 commit 33b0c50

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DJANGO_SUPERUSER_PASSWORD=password

file.ini

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[SETTINGS]
2-
username = roshan
3-
password = qazwsx123123
4-
email = rshn@admin.com
2+
username = django
3+
password = quick
4+
email = django@quick.com

setupSslserver.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@ def setup():#
103103
except Exception as e:
104104
email = ""
105105
if username and password and email:
106-
# subprocess.run(['python', '-m', 'pipenv', 'run', 'python', os.path.join("src", "manage.py"), 'createsuperuser', '--no-input', '--username='+username, '--email='+email])
107-
subprocess.run(['python', '-m', 'pipenv', 'run', 'python', os.path.join("src", "manage.py"), 'createsuperuser', '--username='+username, '--email='+email])
106+
findReplaceAt('.env', 'DJANGO_SUPERUSER_PASSWORD=password\n', 'DJANGO_SUPERUSER_PASSWORD='+password+'\n', 1)
107+
# subprocess.run(['python', '-m', 'pipenv', 'run', 'python', os.path.join("src", "manage.py"), 'createsuperuser', '--username='+username, '--email='+email])
108+
subprocess.run(['python', '-m', 'pipenv', 'run', 'python', os.path.join("src", "manage.py"), 'createsuperuser', '--no-input', '--username='+username, '--email='+email])
109+
findReplaceAt('.env', 'DJANGO_SUPERUSER_PASSWORD='+password+'\n', 'DJANGO_SUPERUSER_PASSWORD=password\n', 1)
108110
else:
109111
print('Enter following details for root user')
110112
subprocess.run(['python', '-m', 'pipenv', 'run', 'python', os.path.join("src", "manage.py"), 'createsuperuser'])

0 commit comments

Comments
 (0)