Question : aws django migrate
Answered by : vipin-yadav
# go to https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html#python-django-update-app
# copy the code
container_commands: 01_migrate: command: "source /var/app/venv/*/bin/activate && python3 manage.py migrate" leader_only: true
option_settings: aws:elasticbeanstalk:application:environment: DJANGO_SETTINGS_MODULE: ebdjango.settings
# on terminal run
nano .ebextentions/db-migrate.config
# paste the above copied code and change DJANGO_SETTINGS_MODULE to
DJANGO_SETTINGS_MODULE: project-name.settings
# now create superusesr using following code
02_createsuperuser: command: "echo \"from django.contrib.auth.models import User; User.objects.create_superuser('vipin', '[email protected]', 'django1234')\" | python manage.py shell" leader_only: true
#save this file and run "eb deploy" on terminal
Source : | Last Update : Mon, 25 Jul 22