Changeset - 05ddedc19d55
[Not reviewed]
Merge
0 5 0
Christopher Neugebauer - 7 years ago 2017-08-16 03:40:18
_@chrisjrn.com
Merge pull request #56 from northbaypython/chrisjrn/herokize

Adds heroku support for ssl-everywhere and S3 uploads
2 files changed with 19 insertions and 1 deletions:
0 comments (0 inline, 0 general)
pinaxcon/settings.py
Show inline comments
...
 
@@ -8,49 +8,54 @@ BASE_DIR = PACKAGE_ROOT
 

	
 
DEBUG = bool(int(os.environ.get("DEBUG", "1")))
 

	
 
DATABASES = {
 
    "default": {
 
        "ENGINE": "django.db.backends.sqlite3",
 
        "NAME": os.path.join(PROJECT_ROOT, "dev.db"),
 
    }
 
}
 

	
 
# HEROKU: Update database configuration with $DATABASE_URL.
 
import dj_database_url
 
db_from_env = dj_database_url.config()
 
DATABASES['default'].update(db_from_env)
 

	
 
ALLOWED_HOSTS = ["localhost", ".herokuapp.com", ".northbaypython.org"]
 

	
 
# Local time zone for this installation. Choices can be found here:
 
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
 
# although not all choices may be available on all operating systems.
 
# On Unix systems, a value of None will cause Django to use the same
 
# 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
 
LANGUAGE_CODE = "en-us"
 

	
 
SITE_ID = int(os.environ.get("SITE_ID", 1))
 

	
 
# If you set this to False, Django will make some optimizations so as not
 
# to load the internationalization machinery.
 
USE_I18N = True
 

	
 
# If you set this to False, Django will not format dates, numbers and
 
# calendars according to the current locale.
 
USE_L10N = True
 

	
 
# If you set this to False, Django will not use timezone-aware datetimes.
 
USE_TZ = True
 

	
 
# Absolute filesystem path to the directory that will hold user-uploaded files.
 
# Example: "/home/media/media.lawrence.com/media/"
 
MEDIA_ROOT = os.path.join(PACKAGE_ROOT, "site_media", "media")
 

	
 
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
 
# trailing slash.
...
 
@@ -59,86 +64,96 @@ MEDIA_URL = "/site_media/media/"
 

	
 
# Absolute path to the directory static files should be collected to.
 
# Don"t put anything in this directory yourself; store your static files
 
# in apps" "static/" subdirectories and in STATICFILES_DIRS.
 
# Example: "/home/media/media.lawrence.com/static/"
 
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
 

	
 
# URL prefix for static files.
 
# Example: "http://media.lawrence.com/static/"
 
STATIC_URL = '/static/'
 

	
 
# Additional locations of static files
 
STATICFILES_DIRS = (
 
    os.path.join(PROJECT_ROOT, 'static'),
 
)
 

	
 
# List of finder classes that know how to find static files in
 
# various locations.
 
STATICFILES_FINDERS = [
 
    "django.contrib.staticfiles.finders.FileSystemFinder",
 
    "django.contrib.staticfiles.finders.AppDirectoriesFinder",
 
    "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(&#2i5mq_^%%@ihu_qxxotl_"
 

	
 
TEMPLATES = [
 
    {
 
        "BACKEND": "django.template.backends.django.DjangoTemplates",
 
        "DIRS": [
 
            os.path.join(PACKAGE_ROOT, "templates"),
 
        ],
 
        "APP_DIRS": True,
 
        "OPTIONS": {
 
            "debug": DEBUG,
 
            "context_processors": [
 
                "django.contrib.auth.context_processors.auth",
 
                "django.template.context_processors.debug",
 
                "django.template.context_processors.i18n",
 
                "django.template.context_processors.media",
 
                "django.template.context_processors.static",
 
                "django.template.context_processors.tz",
 
                "django.template.context_processors.request",
 
                "django.contrib.messages.context_processors.messages",
 
                "account.context_processors.account",
 
                "pinax_theme_bootstrap.context_processors.theme",
 
                "symposion.reviews.context_processors.reviews",
 
            ],
 
        },
 
    },
 
]
 

	
 
MIDDLEWARE_CLASSES = [
 
    "django.contrib.sessions.middleware.SessionMiddleware",
 
    "django.middleware.common.CommonMiddleware",
 
    "django.middleware.csrf.CsrfViewMiddleware",
 
    "django.contrib.auth.middleware.AuthenticationMiddleware",
 
    "django.contrib.auth.middleware.SessionAuthenticationMiddleware",
 
    "django.contrib.messages.middleware.MessageMiddleware",
 
    "reversion.middleware.RevisionMiddleware",
 
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
 
    "ssl_redirect.middleware.SSLRedirectMiddleware",
 

	
 
]
 

	
 
ROOT_URLCONF = "pinaxcon.urls"
 

	
 
# Python dotted path to the WSGI application used by Django's runserver.
 
WSGI_APPLICATION = "pinaxcon.wsgi.application"
 

	
 
INSTALLED_APPS = [
 
    "django.contrib.admin",
 
    "django.contrib.auth",
 
    "django.contrib.contenttypes",
 
    "django.contrib.messages",
 
    "django.contrib.sessions",
 
    "django.contrib.sites",
 
    "django.contrib.staticfiles",
 

	
 
    # theme
 
    "bootstrapform",
 
    "pinax_theme_bootstrap",
 

	
 
    # external
 
    "account",
 
    "easy_thumbnails",
 
    "taggit",
requirements/base.txt
Show inline comments
 
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
 
pinax-eventlog==1.1.1
 
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
 
django-countries==4.6.1
 
easy-thumbnails==2.4.1
 
django-timezone-field==2.0
 
django-model-utils==3.0.0
 

	
 

	
 
# For testing
 
django-nose==1.4.4
 
coverage==4.0.3
 

	
 
# Registrasion
 
https://github.com/chrisjrn/registrasion/tarball/master#egg=registrasion
 
https://github.com/chrisjrn/symposion/tarball/northbaypython#egg=symposion
 
https://github.com/chrisjrn/registrasion-stripe/tarball/master#egg=registrasion-stripe
 
https://github.com/chrisjrn/symposion-bootstrap-templates/tarball/master#egg=symposion-bootstrap-templates
0 comments (0 inline, 0 general)