Mason Gurz
Mason Gurz

Reputation: 13

AWS EBS django not able to deploy with migration error

I have Django app and able to deploy. Its always saying wrong application version please upload with expected version

I debugged into it and found out that mysqlclient was not properly being installed. What can be done to install mysql on the ebs since i cant always logged into the instance and install mysql client manullay everytime.

Upvotes: 1

Views: 109

Answers (1)

Prajwol KC
Prajwol KC

Reputation: 416

You can do this using ebextensions. just create a file as .ebextensions/django.config and use the following settings. ebs uses AMI 2 which uses yum. so you have to use yum packager installer to install the mysql package then use migrate . also you have to use static for serving static files else it will throw error.

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: mysite.wsgi:application
  aws:elasticbeanstalk:environment:proxy:staticfiles:
    /static: static
packages: 
  yum:
    python3-devel: []
    mariadb-devel: []
container_commands:
  01_collectstatic:
    command: "source /var/app/venv/staging-LQM1lest/bin/activate && python manage.py collectstatic --noinput"
  02_migrate:
    command: "source /var/app/venv/staging-LQM1lest/bin/activate && python manage.py migrate --noinput"
    leader_only: true

Upvotes: 2

Related Questions