I have managed to successfully deploy my Django app to AWS Elastic Beanstalk (using eb). I have followed the steps laid out here http://www.youtube.com/watch?v=YJoOnKiSYws and here http://grigory.ca/2012/09/getting-started-with-django-on-aws-elastic-beanstalk/ and am using the django-storages (boto) framework to assist with staticfile management to S3.
I have the following settings in my SETTINGS.PY:
STATIC_ROOT = os.path.join(
os.path.dirname(
os.path.dirname(
os.path.abspath(__file__))), 'static')
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_ACCESS_KEY_ID = 'access-key'
AWS_SECRET_ACCESS_KEY = 'secret-key'
AWS_STORAGE_BUCKET_NAME = 'bucket-name'
STATIC_URL = '/static/'
STATICFILES_DIRS = ()
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
.
.
.
try:
from local_settings import *
except ImportError, e:
pass
and my LOCAL_SETTINGS.PY has the following:
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
('js', '/blah/blah/static/js'),
('css', '/blah/blah/static/css'),
('images', '/blah/blah/static/images'),
)
In my templates I use:
{% load staticfiles %}
<link href="{% static "css/styles.css" %}" rel="stylesheet">
The issue is that when I run the app locally it references my static files in S3 and not in my local directories. What settings do I need to change so that when I run the app locally it uses local static files and that when it runs on AWS it uses S3 files?
can you post your urls.py btw you have to have debug=True to serve static locally This might help you to configure your settings and local_settings