Skip to content

Commit

Permalink
fix: superuser up
Browse files Browse the repository at this point in the history
  • Loading branch information
michelebswm committed Oct 11, 2023
1 parent da44ab8 commit 1839746
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 30 deletions.
6 changes: 0 additions & 6 deletions filme/apps.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
from django.apps import AppConfig

# Importe o arquivo signals.py
from . import ready


class FilmeConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'filme'

def ready(self):
ready.connect_signals()
7 changes: 0 additions & 7 deletions filme/ready.py

This file was deleted.

17 changes: 0 additions & 17 deletions filme/signals.py

This file was deleted.

9 changes: 9 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""Django's command-line utility for administrative tasks."""
import os
import sys
from django.contrib.auth import get_user_model


def main():
Expand All @@ -17,6 +18,14 @@ def main():
) from exc
execute_from_command_line(sys.argv)

# Cria o superusuário se ele ainda não existir
User = get_user_model()
email = os.getenv("EMAIL_ADMIN")
senha = os.getenv("SENHA_ADMIN")
if not User.objects.filter(username='admin').exists():
User.objects.create_superuser(
username='admin', email=email, password=senha, is_active=True, is_staff=True)


if __name__ == '__main__':
main()

0 comments on commit 1839746

Please sign in to comment.