production.py 2.3 KB

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