From 848306a577e0831552444d5461886e9e7156ed37 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Mon, 1 Apr 2013 11:18:43 +0100 Subject: [PATCH] Support S3 static file storage --- app/vapemap/settings.py | 10 +++++++++- requirements.txt | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/vapemap/settings.py b/app/vapemap/settings.py index 805f302..b2fbf66 100644 --- a/app/vapemap/settings.py +++ b/app/vapemap/settings.py @@ -17,7 +17,6 @@ DATABASES = { } ALLOWED_HOSTS = [ - '127.0.0.1', 'vapemap.herokuapp.com', 'vapemap.co.uk', 'vapemap.com', @@ -71,6 +70,7 @@ INSTALLED_APPS = [ 'django.contrib.flatpages', 'gunicorn', 'south', + 'storages', 'markdown_deux', 'epiceditor', 'bootstrapform', @@ -155,3 +155,11 @@ HAYSTACK_CONNECTIONS = { 'INDEX_NAME': 'vapemap-haystack', }, } + +if not DEBUG: + AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID'] + AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY'] + AWS_STORAGE_BUCKET_NAME = os.environ['AWS_STORAGE_BUCKET_NAME'] + STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage' + S3_URL = 'http://%s.s3.amazonaws.com/' % AWS_STORAGE_BUCKET_NAME + STATIC_URL = S3_URL \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 52514fd..428f281 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,4 +14,6 @@ django-epiceditor # Heroku dj-database-url gunicorn -psycopg2 \ No newline at end of file +psycopg2 +django-storages +boto \ No newline at end of file