Steven Rogers
Steven Rogers

Reputation: 1994

Trouble launching AWS environment with django

I followed the steps line by line in the documentation, but i keep getting this error:

Your WSGIPath refers to a file that does not exist.

Here is my '.config' file: (except for the appname and the keys)

container_commands:
  01_syncdb:
    command: "python manage.py syncdb --noinput"
    leader_only: true

option_settings:
  - namespace: aws:elasticbeanstalk:container:python
    option_name: WSGIPath
    value: [myapp]/wsgi.py
  - option_name: DJANGO_SETTINGS_MODULE
    value: [myapp].settings
  - option_name: AWS_SECRET_KEY
    value: XXXX
  - option_name: AWS_ACCESS_KEY_ID
    value: XXXX

I googled around and found that someone else had a similar problem and they solved it by editing the 'optionsettings.[myapp]', I don't want to delete something I need, but here is what I have:

[aws:autoscaling:asg]
Custom Availability Zones=
MaxSize=1
MinSize=1

[aws:autoscaling:launchconfiguration]
EC2KeyName=
InstanceType=t1.micro

[aws:autoscaling:updatepolicy:rollingupdate]
RollingUpdateEnabled=false

[aws:ec2:vpc]
Subnets=
VPCId=

[aws:elasticbeanstalk:application]
Application Healthcheck URL=

[aws:elasticbeanstalk:application:environment]
DJANGO_SETTINGS_MODULE=
PARAM1=
PARAM2=
PARAM3=
PARAM4=
PARAM5=

[aws:elasticbeanstalk:container:python]
NumProcesses=1
NumThreads=15
StaticFiles=/static/=static/
WSGIPath=application.py

[aws:elasticbeanstalk:container:python:staticfiles]
/static/=static/

[aws:elasticbeanstalk:hostmanager]
LogPublicationControl=false

[aws:elasticbeanstalk:monitoring]
Automatically Terminate Unhealthy Instances=true

[aws:elasticbeanstalk:sns:topics]
Notification Endpoint=
Notification Protocol=email

[aws:rds:dbinstance]
DBDeletionPolicy=Snapshot
DBEngine=mysql
DBInstanceClass=db.t1.micro
DBSnapshotIdentifier=
DBUser=ebroot

The user who solved that problem deleted certain lines and then did 'eb start'. I deleted the same lines that the original user said they deleted, but when I 'eb start'ed it I got the same exact problem again.

If anybody can help me out, that would be amazing!

Upvotes: 0

Views: 1669

Answers (1)

Tomdanizer
Tomdanizer

Reputation: 66

I was having this exact problem all day yesterday and I am using ubuntu 13.10. I also tried deleting the options file under .ebextensions to no avail. What I believe finally fixed the issue was under ~/mysite/requirements.txt I double checked what the values were after I was all set and done doing eb init and eb start and noticed they were different from what http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html mentioned at the beginning of the tutorial. The file was missing the MySQL line when I checked during the WSGIPath problem, I simply added the line :

MySQL-python==1.2.3

and then committed all the changes and it worked.

If that doesn't work for you, below are the .config file settings and the directory structure.

My .config file under ~/mysite/.ebextensions is exactly what was in the tutorial, minus the secret key and access key, you need to replace those with your own:

container_commands:
  01_syncdb:    
    command: "django-admin.py syncdb --noinput"
    leader_only: true

option_settings:
  - namespace: aws:elasticbeanstalk:container:python
    option_name: WSGIPath
    value: mysite/wsgi.py
  - option_name: DJANGO_SETTINGS_MODULE
    value: mysite.settings
  - option_name: AWS_SECRET_KEY
    value: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
  - option_name: AWS_ACCESS_KEY_ID
    value: AKIAIOSFODNN7EXAMPLE

My requirements.txt:

Django==1.4.1
MySQL-python==1.2.3
argparse==1.2.1
wsgiref==0.1.2

And my tree structure. This starts out in ~/ so if I were to do

  • cd ~/
  • tree -a mysite

You should get the following output, including a bunch of directories under .git ( I removed them because there is a lot):

mysite
├── .ebextensions
│   └── myapp.config
├── .elasticbeanstalk
│   ├── config
│   └── optionsettings.mysite-env
├── .git
├── .gitignore
├── manage.py
├── mysite
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── settings.py
│   ├── settings.pyc
│   ├── urls.py
│   ├── wsgi.py
│   └── wsgi.pyc
└── requirements.txt

Upvotes: 1

Related Questions