Paul Jakma | 7e43fe4 | 2017-03-04 15:09:41 +0000 | [diff] [blame] | 1 | """ |
| 2 | Sample production-ready settings for patchwork project. |
| 3 | |
| 4 | Most of these are commented out as they will be installation dependent. |
| 5 | |
| 6 | Design based on: |
| 7 | http://www.revsys.com/blog/2014/nov/21/recommended-django-project-layout/ |
| 8 | """ |
| 9 | |
| 10 | from __future__ import absolute_import |
| 11 | |
| 12 | import os |
| 13 | |
| 14 | import django |
| 15 | |
| 16 | from .base import * # noqa |
| 17 | |
| 18 | DEBUG = True |
| 19 | # |
| 20 | # Core settings |
| 21 | # https://docs.djangoproject.com/en/1.8/ref/settings/#core-settings |
| 22 | # |
| 23 | |
| 24 | # Security |
| 25 | # |
| 26 | # You'll need to replace this to a random string. The following python code can |
| 27 | # be used to generate a secret key: |
| 28 | # |
| 29 | # import string, random |
| 30 | # chars = string.letters + string.digits + string.punctuation |
| 31 | # print repr("".join([random.choice(chars) for i in range(0,50)])) |
| 32 | |
| 33 | # Email |
| 34 | # |
| 35 | # Replace this with your own details |
| 36 | |
| 37 | EMAIL_HOST = os.getenv('EMAIL_HOST', 'localhost') |
| 38 | EMAIL_PORT = os.getenv('EMAIL_PORT', 25) |
| 39 | EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER', '') |
| 40 | # password goes in pass.py |
| 41 | EMAIL_USE_TLS = True |
| 42 | |
| 43 | DEFAULT_FROM_EMAIL = 'Patchwork <patchwork@patchwork.quagga.net>' |
| 44 | SERVER_EMAIL = DEFAULT_FROM_EMAIL |
| 45 | NOTIFICATION_FROM_EMAIL = DEFAULT_FROM_EMAIL |
| 46 | |
| 47 | ADMINS = ( |
| 48 | ('Paul Jakma', 'paul@quagga.net'), |
| 49 | ) |
| 50 | |
| 51 | # Database |
| 52 | # |
| 53 | # If you're using a postgres database, connecting over a local unix-domain |
| 54 | # socket, then the following setting should work for you. Otherwise, |
| 55 | # see https://docs.djangoproject.com/en/1.8/ref/settings/#databases |
| 56 | |
| 57 | # password goes in pass.py |
| 58 | DATABASES = { |
| 59 | 'default': { |
| 60 | 'ENGINE': 'django.db.backends.mysql', |
| 61 | 'NAME': os.environ.get('DATABASE_NAME', 'patchwork'), |
| 62 | 'USER': os.environ.get('DATABASE_USER', 'patchwork'), |
| 63 | 'HOST': '127.0.0.1', |
| 64 | }, |
| 65 | } |
| 66 | |
| 67 | |
| 68 | # |
| 69 | # Static files settings |
| 70 | # https://docs.djangoproject.com/en/1.8/ref/settings/#static-files |
| 71 | # https://docs.djangoproject.com/en/1.8/ref/contrib/staticfiles/#manifeststaticfilesstorage |
| 72 | # |
| 73 | |
| 74 | STATIC_ROOT = os.environ.get('STATIC_ROOT', '/home/patchwork/htdocs/static') |
| 75 | |
| 76 | |
| 77 | if django.VERSION >= (1, 7): |
| 78 | STATICFILES_STORAGE = \ |
| 79 | 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' |
| 80 | |
| 81 | ENABLE_XMLRPC = True |
| 82 | |
| 83 | LANGUAGE_CODE='en-gb' |
| 84 | TIME_ZONE='GMT' |
| 85 | ALLOWED_HOSTS=['patchwork.quagga.net','testpw.quagga.net', 'http', 'http.quagga.net', '*.quagga.net'] |
| 86 | |
| 87 | with open("patchwork/settings/pass.py") as f: |
| 88 | code = compile(f.read(), "patchwork/settings/pass.py", 'exec') |
| 89 | exec(code) |