Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
bookshare
Commits
40bbe0f3
Commit
40bbe0f3
authored
Apr 21, 2015
by
Daniel W Bond
Browse files
set up optionally sending media files to s3
parent
034f5813
Changes
2
Hide whitespace changes
Inline
Side-by-side
bookshare/settings/secret.py.template
View file @
40bbe0f3
...
...
@@ -26,3 +26,9 @@ PIWIK_URL = ''
EMAIL_HOST = 'email-smtp.region-code.amazonaws.com'
EMAIL_HOST_USER = 'ses-smtp-username'
EMAIL_HOST_PASSWORD = 'ses-smtp-password'
# configurations to upload user media to Amazon S3
# these settings will not matter if MEDIA_S3 is set to False in settings.py
AWS_STORAGE_BUCKET_NAME = 'my-bucket'
AWS_ACCESS_KEY_ID = ''
AWS_SECRET_ACCESS_KEY = ''
bookshare/settings/settings.py
View file @
40bbe0f3
...
...
@@ -43,6 +43,7 @@ INSTALLED_APPS = (
'crispy_forms'
,
'haystack'
,
'piwik'
,
'storages'
,
)
CRISPY_TEMPLATE_PACK
=
'bootstrap3'
...
...
@@ -105,9 +106,6 @@ STATICFILES_DIRS = (
os
.
path
.
join
(
BASE_DIR
,
'static'
),
)
MEDIA_URL
=
'/media/'
MEDIA_ROOT
=
(
os
.
path
.
join
(
BASE_DIR
,
'media'
))
AUTHENTICATION_BACKENDS
=
(
'django.contrib.auth.backends.ModelBackend'
,
'cas.backends.CASBackend'
,
...
...
@@ -145,3 +143,23 @@ EMAIL_HOST = secret.EMAIL_HOST
EMAIL_PORT
=
'465'
EMAIL_HOST_USER
=
secret
.
EMAIL_HOST_USER
EMAIL_HOST_PASSWORD
=
secret
.
EMAIL_HOST_PASSWORD
# Media configurations
MEDIA_S3
=
False
if
MEDIA_S3
:
AWS_HEADERS
=
{
# see http://developer.yahoo.com/performance/rules.html#expires
'Expires'
:
'Thu, 31 Dec 2099 20:00:00 GMT'
,
'Cache-Control'
:
'max-age=94608000'
,
}
AWS_STORAGE_BUCKET_NAME
=
secret
.
AWS_STORAGE_BUCKET_NAME
AWS_ACCESS_KEY_ID
=
secret
.
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
=
secret
.
AWS_SECRET_ACCESS_KEY
AWS_S3_CUSTOM_DOMAIN
=
'%s.s3.amazonaws.com'
%
AWS_STORAGE_BUCKET_NAME
MEDIA_URL
=
"https://%s/"
%
AWS_S3_CUSTOM_DOMAIN
DEFAULT_FILE_STORAGE
=
'storages.backends.s3boto.S3BotoStorage'
else
:
MEDIA_URL
=
'/media/'
MEDIA_ROOT
=
(
os
.
path
.
join
(
BASE_DIR
,
'media'
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment