-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e290596
commit ebcc9b2
Showing
5 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -e | ||
python manage.py migrate | ||
python manage.py makesuperuser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
set -e | ||
gunicorn iridisite.wsgi --log-file - |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from django.utils.crypto import get_random_string | ||
from django.core.management.base import BaseCommand | ||
from django.contrib.auth import get_user_model | ||
|
||
User = get_user_model() | ||
|
||
class Command(BaseCommand): | ||
def handle(self, *args, **options): | ||
email = "admin@example.com" | ||
new_password = get_random_string(10) | ||
try: | ||
if not User.objects.filter(is_superuser=True).exists(): | ||
User.objects.create_superuser(username="admin", email=email, password=new_password) | ||
self.stdout.write("=======================") | ||
self.stdout.write("Username: admin") | ||
self.stdout.write(f"Email: {email}") | ||
self.stdout.write(f"Password: {new_password}") | ||
self.stdout.write("=======================") | ||
else: | ||
self.stdout.write("Superuser already exists. Skipping...") | ||
except Exception as e: | ||
self.stdout.write(str(e)) | ||
self.stdout.write("Failed to create superuser.") |