From 05ddedc19d55035d0bcdfd16aba1a5e584805660 2017-08-16 03:40:18 From: Christopher Neugebauer <_@chrisjrn.com> Date: 2017-08-16 03:40:18 Subject: [PATCH] Merge pull request #56 from northbaypython/chrisjrn/herokize Adds heroku support for ssl-everywhere and S3 uploads --- diff --git a/pinaxcon/settings.py b/pinaxcon/settings.py index f403c4b4f986be0f02ef95764ce4b7d049bdb40d..715d4469c6743a91874e0507ff20af2a0f945880 100644 --- a/pinaxcon/settings.py +++ b/pinaxcon/settings.py @@ -29,7 +29,12 @@ ALLOWED_HOSTS = ["localhost", ".herokuapp.com", ".northbaypython.org"] # timezone as the operating system. # If running in a Windows environment this must be set to the same as your # system time zone. -TIME_ZONE = "UTC" +TIME_ZONE = os.environ.get("TZ", "America/Los_Angeles") + + +# Use SSLRedirectMiddleware +SSL_ON = os.environ.get("DJANGO_SSL_ON", True) +SSL_ALWAYS = os.environ.get("DJANGO_SSL_ALWAYS", False) # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html @@ -80,6 +85,14 @@ STATICFILES_FINDERS = [ "compressor.finders.CompressorFinder", ] + +# Amazon S3 setup +DEFAULT_FILE_STORAGE = os.environ.get("DJANGO_DEFAULT_FILE_STORAGE", 'django.core.files.storage.FileSystemStorage') # noqa +AWS_ACCESS_KEY_ID = os.environ.get("DJANGO_AWS_ACCESS_KEY_ID", None) +AWS_SECRET_ACCESS_KEY = os.environ.get("DJANGO_AWS_SECRET_ACCESS_KEY", None) +AWS_STORAGE_BUCKET_NAME = os.environ.get("DJANGO_AWS_STORAGE_BUCKET_NAME", None) + + # Make this unique, and don't share it with anybody. SECRET_KEY = "6r&z0i#!k-thu4nv^zzx!f$fbp(i5mq_^%%@ihu_qxxotl_" @@ -118,6 +131,8 @@ MIDDLEWARE_CLASSES = [ "django.contrib.messages.middleware.MessageMiddleware", "reversion.middleware.RevisionMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", + "ssl_redirect.middleware.SSLRedirectMiddleware", + ] ROOT_URLCONF = "pinaxcon.urls" diff --git a/requirements/base.txt b/requirements/base.txt index 36a1dc51d405ce37e77239ee5559c7e271f5c787..721638f3936aedbd6d5974d10f0a3f8cce03bc9a 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,4 +1,5 @@ Django>=1.11,<1.12 +boto3==1.4.6 pinax-theme-bootstrap==7.3.0 django-user-accounts==1.3.1 metron==1.3.7 @@ -7,6 +8,8 @@ dj-static==0.0.6 dj-database-url==0.4.0 pinax-pages==0.4.2 pinax-boxes==2.1.2 +django-ssl-redirect==2.0 +django-storages==1.6.5 django-libsass==0.7 django-markdown-deux==1.0.5 django-sitetree==1.8.0