jeudi 4 septembre 2014

Serving static files on S3 with Django DEBUG set to False


Vote count:

0




I have my Django Heroku app up and running only when DEBUG=True in the settings.py (same problem as here)


As soon as DEBUG=False, it gives me status 500 errors (even after collectstatic is performed) which is to be expected only without a static file server. Any ideas why it only runs with Debug=True?


I have the following relevant settings after following: Proper way to handle static files and templates for Django on Heroku



DEBUG=False
ALLOWED_HOSTS = ['*',]
WSGI_APPLICATION = 'example.wsgi.application'

AWS_STORAGE_BUCKET_NAME = os.environ['AWS_STORAGE_BUCKET_NAME']
AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID']
AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY']

DEFAULT_FILE_STORAGE = 's3_folder_storage.s3.DefaultStorage'
DEFAULT_S3_PATH = 'media'
STATICFILES_STORAGE = 's3_folder_storage.s3.StaticStorage'
STATIC_S3_PATH = 'static'

S3_URL = 'http://%s.s3.amazonaws.com/' % AWS_STORAGE_BUCKET_NAME
MEDIA_ROOT = '/media/'
MEDIA_URL = '//s3.amazonaws.com/%s/media/' % AWS_STORAGE_BUCKET_NAME
STATIC_ROOT = '/static/'
STATIC_URL = '//s3.amazonaws.com/%s/static/' % AWS_STORAGE_BUCKET_NAME

ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'
AWS_ENABLED = True

INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.sitemaps',
'photologue',
'compressor',
'paypal.standard.ipn',
'gunicorn',
'sortedm2m',
'tagging',
'south',
'example',
'storages',
's3_folder_storage',
'tinymce',
]


asked 28 secs ago

ecoe

368






Serving static files on S3 with Django DEBUG set to False

Aucun commentaire:

Enregistrer un commentaire