How to deploy Django application on Amazon AWS?

Hello,

I'm trying to deploy a simple application to Amazon AWS; before I deploy my real application, I'm following this tutorial: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html 

But I'm getting this error when I type in the "eb deploy" command: ERROR: Your WSGIPath refers to a file that does not exist.

Here is my WSGI file:
"""
WSGI config for mysite project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""

import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Open in new window


Appreciate any help in resolving this error!
Errang GenevreAsked:
Who is Participating?
 
btanExec ConsultantCommented:
not a document per se but may be useful, do review it. the requirement.txt in the github is
Django==1.7.1
Pillow==2.6.1
psycopg2==2.5.4
wsgiref==0.1.2
https://realpython.com/blog/python/deploying-a-django-app-to-aws-elastic-beanstalk/
0
 
gheistCommented:
Where is the error?
0
 
btanExec ConsultantCommented:
The error is stated as "ERROR: Your WSGIPath refers to a file that does not exist."

Likely this is due to storing all of the code in one directory instead the correct mean is to have it in its respective code in its corresponding folder (not in single parent site folder ).
your root directory would look like this:
.
├── .ebextensions
│   └── python.config
├── .elasticbeanstalk
│   ├── config
├── .git
├── .gitignore
├── manage.py
├── mysite
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
└── requirements.txt
Instead of this:
.
└── mysite
    ├── .ebextensions
    ├── .elasticbeanstalk
    ├── .git
    ├── .gitignore
    ├── manage.py
    ├── mysite
    └── requirements.txt
https://forums.aws.amazon.com/thread.jspa?messageID=396656#396656

Note also make sure your requirements.txt file contains the Django and MySQL version numbers that you want to use.
Django==1.4.1
MySQL-python==1.2.3
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Errang GenevreAuthor Commented:
@gheist

This is the error I'm getting: ERROR: Your WSGIPath refers to a file that does not exist.

@btan

Yes, I saw the Django 1.4.1 version; but my project was built using Django 1.7.1, and it is not compatible with Django 1.4.1

I can't find any real documentation on deploying Django 1.7.
0
 
Errang GenevreAuthor Commented:
At the end of the day, I would greatly appreciate a tutorial on how to deploy Django 1.7 onto Amazon Elastic Beanstalk.

I still haven't been able to find *any* documentation on that.
0
 
gheistCommented:
You posted a tutorial in your question? It is in English, so you can read it?

At which step you get the error? Is demo site working without apache?
0
 
Errang GenevreAuthor Commented:
@gheist

The Amazon tutorial I posted only works for 1.4.1. And yes, I can read it, and I tried about 5 variations of the tutorial.

And I'm getting an error at the step with the alias; so I know that tutorial is outdated.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.