Config file cleanup

- remove a whole bunch of comments, they're useless

 - Update TimeZone to Sydney

 - Don't colocate MEDIA (user uploads), with STATIC in fact,
   how is this set, Django has a safety check for this and bails.

 - Do not store a default SECRET_KEY in git.
   We'll set a random one by default, so things "just work"
   It would also be acceptable to not set it and let DJ bail

 - We dont want to log to a file.  Our disks are ephemeral.

 - We likely will not overlay a production settings.py over this one.
   We need to implement something that is more container friendly in the
   future.  This will be env-vars or a config file.
This commit is contained in:
Sachi King 2017-03-05 16:58:32 +11:00
parent cae05aeebc
commit a239d12e2d
2 changed files with 8 additions and 72 deletions

2
.gitignore vendored
View file

@ -8,8 +8,6 @@ dev.db
.coverage
pinaxcon/site_media/
local_settings.py
log
\.#*
*#*#
.ve2

View file

@ -1,5 +1,6 @@
import os
import dj_database_url
from django.utils.crypto import get_random_string
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
@ -22,72 +23,29 @@ CACHES = {
}
ALLOWED_HOSTS = ['2017.pycon-au.org', 'zookeepr1.linux.org.au']
ALLOWED_HOSTS = ['lca2018.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 = "Australia/Melbourne"
# The date format for this installation
TIME_ZONE = "Australia/Sydney"
DATE_FORMAT = "j F Y"
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = "en-au"
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.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
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(PACKAGE_ROOT, "site_media", "static")
STATIC_ROOT = os.path.join(PROJECT_ROOT, "static", "dist")
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
#STATIC_URL = "/site_media/static/"
STATIC_URL = "/static/dist/"
# Additional locations of static files
STATICFILES_DIRS = [
os.path.join(PROJECT_ROOT, "static", "dist"),
]
# 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",
]
# Make this unique, and don't share it with anybody.
SECRET_KEY = "6r&z0i#!k-thu4nv^zzx!f$fbp(&#2i5mq_^%%@ihu_qxxotl_"
SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY", get_random_string(length=64))
TEMPLATES = [
{
@ -237,7 +195,7 @@ LOGGING = {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'simple': {
'format': '%(levelname)s %(message)s'
'format': '%(asctime)s %(levelname)s $(module)s %(message)s'
},
},
'filters': {
@ -246,23 +204,11 @@ LOGGING = {
}
},
'handlers': {
# 'null': {
# 'level':'DEBUG',
# 'class':'django.utils.log.NullHandler',
# },
'console':{
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
},
# I always add this handler to facilitate separating loggings
'log_file':{
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': os.path.abspath('log/django.log'),
'maxBytes': '16777216', # 16megabytes
'formatter': 'verbose'
},
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
@ -281,15 +227,9 @@ LOGGING = {
'level': 'DEBUG',
'propagate': True,
},
'apps': { # I keep all my of apps under 'apps' folder, but you can also add them one by one, and this depends on how your virtualenv/paths are set
'handlers': ['log_file'],
'level': 'DEBUG',
'propagate': True,
},
},
# you can also shortcut 'loggers' and just configure logging for EVERYTHING at once
'root': {
'handlers': ['console', 'log_file'], #'mail_admins'],
'handlers': ['console'],
'level': 'DEBUG'
},
}
@ -307,7 +247,7 @@ ACCOUNT_LOGOUT_REDIRECT_URL = "/"
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 2
ACCOUNT_USE_AUTH_AUTHENTICATE = True
THEME_CONTACT_EMAIL = "pyconau-orgs@lists.linux.org.au"
THEME_CONTACT_EMAIL = "team@lca2018.org"
AUTHENTICATION_BACKENDS = [
"symposion.teams.backends.TeamPermissionsBackend",
@ -345,7 +285,7 @@ PINAX_STRIPE_SECRET_KEY = os.environ.get("STRIPE_SECRET_KEY", "your test secret
PINAX_STRIPE_SEND_EMAIL_RECEIPTS = False
# Wagtail config
WAGTAIL_SITE_NAME = 'Pycon Australia 2017'
WAGTAIL_SITE_NAME = 'linux.conf.au 2018'
WAGTAIL_APPEND_SLASH = True
WAGTAILIMAGES_IMAGE_MODEL = 'cms_pages.CustomImage'
@ -357,8 +297,6 @@ CSRF_FAILURE_VIEW = "pinaxcon.csrf_view.csrf_failure"
# Use nose to run all tests
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
ADMIN_USERNAMES = []
# Tell nose to measure coverage on the 'foo' and 'bar' apps
NOSE_ARGS = [
'--with-coverage',