From f4ab6d687404f27cbf9b3a3b42c0867a70eb7f21 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Tue, 15 Aug 2017 19:58:54 -0700 Subject: [PATCH 1/3] Time Zone --- pinaxcon/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pinaxcon/settings.py b/pinaxcon/settings.py index f403c4b..93e0f9b 100644 --- a/pinaxcon/settings.py +++ b/pinaxcon/settings.py @@ -29,7 +29,7 @@ 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") # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html From 0a88ccce181067a3e7ff2e9dd8e6387a5b5f452d Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Tue, 15 Aug 2017 20:07:45 -0700 Subject: [PATCH 2/3] Adds environment variables to always serve over HTTPS --- pinaxcon/settings.py | 7 +++++++ requirements/base.txt | 1 + 2 files changed, 8 insertions(+) diff --git a/pinaxcon/settings.py b/pinaxcon/settings.py index 93e0f9b..67541dd 100644 --- a/pinaxcon/settings.py +++ b/pinaxcon/settings.py @@ -31,6 +31,11 @@ ALLOWED_HOSTS = ["localhost", ".herokuapp.com", ".northbaypython.org"] # system time zone. 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 LANGUAGE_CODE = "en-us" @@ -118,6 +123,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 36a1dc5..d687314 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -7,6 +7,7 @@ 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-libsass==0.7 django-markdown-deux==1.0.5 django-sitetree==1.8.0 From 3d1a38f4c937101ffb9dcdeed75b13eaf1872316 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Tue, 15 Aug 2017 20:37:54 -0700 Subject: [PATCH 3/3] Adds an S3 storage backend --- pinaxcon/settings.py | 8 ++++++++ requirements/base.txt | 2 ++ 2 files changed, 10 insertions(+) diff --git a/pinaxcon/settings.py b/pinaxcon/settings.py index 67541dd..715d446 100644 --- a/pinaxcon/settings.py +++ b/pinaxcon/settings.py @@ -85,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_" diff --git a/requirements/base.txt b/requirements/base.txt index d687314..721638f 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 @@ -8,6 +9,7 @@ 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