Add initial createsuperuser command

This commit is contained in:
Wan Liuyang 2017-12-19 16:35:02 +08:00
parent d372ec05f9
commit c1044f0f00

View File

@ -4,6 +4,9 @@ container_commands:
leader_only: True
02_collectstatic:
command: "source /opt/python/run/venv/bin/activate && python manage.py collectstatic --noinput"
03_createsuperuser:
command: "(echo \"import os\"; echo \"from django.contrib.auth import get_user_model\"; echo \"UserModel = get_user_model()\"; echo \"if not UserModel._default_manager.filter(username='admin').exists(): UserModel._default_manager.create_superuser(**dict(username='admin',email='admin@example.com',password=os.environ['SECRET_KEY'][:8]));\") | django-admin.py shell"
leader_only: True
option_settings:
"aws:elasticbeanstalk:application:environment":
DJANGO_SETTINGS_MODULE: "config.settings.production"