settings_base.py 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. import os
  4. import ldap
  5. # Django settings for coin project.
  6. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  7. BASE_DIR = os.path.dirname(os.path.dirname(__file__))
  8. PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
  9. DEBUG = TEMPLATE_DEBUG = True
  10. ADMINS = (
  11. # ('Your Name', 'your_email@example.com'),
  12. )
  13. MANAGERS = ADMINS
  14. DATABASES = {
  15. # Database hosted on vagant test box
  16. 'default': {
  17. 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  18. 'NAME': 'coin',
  19. 'USER': 'coin',
  20. 'PASSWORD': 'coin',
  21. 'HOST': 'localhost', # Empty for localhost through domain sockets
  22. 'PORT': '15432', # Empty for default
  23. },
  24. }
  25. # Hosts/domain names that are valid for this site; required if DEBUG is False
  26. # See https://docs.djangoproject.com/en/1.7/ref/settings/#allowed-hosts
  27. ALLOWED_HOSTS = []
  28. # Local time zone for this installation. Choices can be found here:
  29. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  30. # although not all choices may be available on all operating systems.
  31. # In a Windows environment this must be set to your system time zone.
  32. TIME_ZONE = 'Europe/Paris'
  33. # Language code for this installation. All choices can be found here:
  34. # http://www.i18nguy.com/unicode/language-identifiers.html
  35. LANGUAGE_CODE = 'fr-fr'
  36. SITE_ID = 1
  37. # If you set this to False, Django will make some optimizations so as not
  38. # to load the internationalization machinery.
  39. USE_I18N = True
  40. # If you set this to False, Django will not format dates, numbers and
  41. # calendars according to the current locale.
  42. USE_L10N = True
  43. # If you set this to False, Django will not use timezone-aware datetimes.
  44. USE_TZ = True
  45. # Default URL for login and logout
  46. LOGIN_URL = '/members/login'
  47. LOGIN_REDIRECT_URL = '/members'
  48. LOGOUT_URL = '/members/logout'
  49. # Absolute filesystem path to the directory that will hold user-uploaded files.
  50. # Example: "/var/www/example.com/media/"
  51. MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
  52. # URL that handles the media served from MEDIA_ROOT. Make sure to use a
  53. # trailing slash.
  54. # Examples: "http://example.com/media/", "http://media.example.com/"
  55. MEDIA_URL = '/media/'
  56. # Absolute path to the directory static files should be collected to.
  57. # Don't put anything in this directory yourself; store your static files
  58. # in apps' "static/" subdirectories and in STATICFILES_DIRS.
  59. # Example: "/var/www/example.com/static/"
  60. STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
  61. # URL prefix for static files.
  62. # Example: "http://example.com/static/", "http://static.example.com/"
  63. STATIC_URL = '/static/'
  64. # Additional locations of static files
  65. STATICFILES_DIRS = (
  66. # Put strings here, like "/home/html/static" or "C:/www/django/static".
  67. # Always use forward slashes, even on Windows.
  68. # Don't forget to use absolute paths, not relative paths.
  69. )
  70. # List of finder classes that know how to find static files in
  71. # various locations.
  72. STATICFILES_FINDERS = (
  73. 'django.contrib.staticfiles.finders.FileSystemFinder',
  74. 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  75. #'django.contrib.staticfiles.finders.DefaultStorageFinder',
  76. )
  77. # Location of private files. (Like invoices)
  78. # In production, this location should not be publicly accessible through
  79. # the web server
  80. PRIVATE_FILES_ROOT = os.path.join(BASE_DIR, 'smedia/')
  81. # Backend to use when sending private files to client
  82. # In production, must be sendfile.backends.xsendfile with Apache xsend file mod
  83. # Or failing xsendfile, use : sendfile.backends.simple
  84. # https://github.com/johnsensible/django-sendfile
  85. SENDFILE_BACKEND = 'sendfile.backends.development'
  86. # Make this unique, and don't share it with anybody.
  87. SECRET_KEY = '!qy_)gao6q)57#mz1s-d$5^+dp1nt=lk1d19&9bb3co37vn)!3'
  88. # List of callables that know how to import templates from various sources.
  89. TEMPLATE_LOADERS = (
  90. 'django.template.loaders.filesystem.Loader',
  91. 'django.template.loaders.app_directories.Loader',
  92. #'django.template.loaders.eggs.Loader',
  93. )
  94. MIDDLEWARE_CLASSES = (
  95. 'debug_toolbar.middleware.DebugToolbarMiddleware',
  96. 'django.middleware.common.CommonMiddleware',
  97. 'django.contrib.sessions.middleware.SessionMiddleware',
  98. 'django.middleware.csrf.CsrfViewMiddleware',
  99. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  100. 'django.contrib.messages.middleware.MessageMiddleware',
  101. # Uncomment the next line for simple clickjacking protection:
  102. # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  103. )
  104. # Do not load jQuery from crappy CDN
  105. DEBUG_TOOLBAR_CONFIG = {
  106. 'JQUERY_URL': '/static/js/vendor/jquery.js'
  107. }
  108. # Used for debug toolbar
  109. INTERNAL_IPS = ['127.0.0.1', '::1']
  110. ROOT_URLCONF = 'coin.urls'
  111. # Python dotted path to the WSGI application used by Django's runserver.
  112. WSGI_APPLICATION = 'coin.wsgi.application'
  113. TEMPLATE_DIRS = (
  114. # Only absolute paths, always forward slashes
  115. os.path.join(PROJECT_PATH, 'templates/'),
  116. )
  117. EXTRA_TEMPLATE_DIRS = tuple()
  118. INSTALLED_APPS = (
  119. 'debug_toolbar', # always installed, but enabled only if DEBUG=True
  120. 'django.contrib.auth',
  121. 'django.contrib.contenttypes',
  122. 'django.contrib.sessions',
  123. 'django.contrib.sites',
  124. 'ldapdb', # LDAP as database backend
  125. 'django.contrib.messages',
  126. 'django.contrib.staticfiles',
  127. # Uncomment the next line to enable the admin:
  128. 'django.contrib.admin',
  129. 'netfields',
  130. # Uncomment the next line to enable admin documentation:
  131. #'django.contrib.admindocs',
  132. 'polymorphic',
  133. # 'south',
  134. 'autocomplete_light', #Automagic autocomplete foreingkey form component
  135. 'activelink', #Detect if a link match actual page
  136. 'coin',
  137. 'coin.members',
  138. 'coin.offers',
  139. 'coin.billing',
  140. 'coin.resources',
  141. 'coin.reverse_dns',
  142. 'coin.configuration',
  143. 'coin.isp_database',
  144. )
  145. EXTRA_INSTALLED_APPS = tuple()
  146. # A sample logging configuration. The only tangible logging
  147. # performed by this configuration is to send an email to
  148. # the site admins on every HTTP 500 error when DEBUG=False.
  149. # See http://docs.djangoproject.com/en/dev/topics/logging for
  150. # more details on how to customize your logging configuration.
  151. LOGGING = {
  152. 'version': 1,
  153. 'disable_existing_loggers': False,
  154. 'formatters': {
  155. },
  156. 'filters': {
  157. 'require_debug_false': {
  158. '()': 'django.utils.log.RequireDebugFalse'
  159. }
  160. },
  161. 'handlers': {
  162. 'mail_admins': {
  163. 'level': 'ERROR',
  164. 'filters': ['require_debug_false'],
  165. 'class': 'django.utils.log.AdminEmailHandler'
  166. },
  167. 'console': {
  168. 'class': 'logging.StreamHandler',
  169. },
  170. },
  171. 'loggers': {
  172. 'django.request': {
  173. 'handlers': ['mail_admins'],
  174. 'level': 'ERROR',
  175. 'propagate': True,
  176. },
  177. 'django': {
  178. 'handlers': ['console'],
  179. 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
  180. },
  181. "coin.billing": {
  182. 'handlers': ['console'],
  183. 'level': 'INFO',
  184. }
  185. }
  186. }
  187. TEMPLATE_CONTEXT_PROCESSORS = (
  188. "django.contrib.auth.context_processors.auth",
  189. "django.core.context_processors.debug",
  190. "django.core.context_processors.i18n",
  191. "django.core.context_processors.media",
  192. "django.core.context_processors.static",
  193. "django.core.context_processors.tz",
  194. "django.core.context_processors.request",
  195. "coin.isp_database.context_processors.branding",
  196. "coin.context_processors.installed_apps",
  197. "django.contrib.messages.context_processors.messages")
  198. AUTH_USER_MODEL = 'members.Member'
  199. AUTHENTICATION_BACKENDS = (
  200. 'django.contrib.auth.backends.ModelBackend',
  201. )
  202. TEST_RUNNER = 'django.test.runner.DiscoverRunner'
  203. GRAPHITE_SERVER = "http://localhost"
  204. # Configuration for outgoing emails
  205. #DEFAULT_FROM_EMAIL = "coin@example.com"
  206. #EMAIL_USE_TLS = True
  207. #EMAIL_HOST = "smtp.chezmoi.tld"
  208. # Do we use LDAP or not
  209. LDAP_ACTIVATE = False
  210. # Not setting them results in NameError
  211. LDAP_USER_BASE_DN = None
  212. VPN_CONF_BASE_DN = None
  213. # Allow member to edit their vpn
  214. MEMBER_CAN_EDIT_VPN_CONF = True
  215. # Membership configuration
  216. # Default cotisation in €, per year
  217. DEFAULT_MEMBERSHIP_FEE = 20
  218. # Link to a page with information on how to become a member or pay the
  219. # membership fee
  220. MEMBER_MEMBERSHIP_INFO_URL = ''
  221. # Pattern used to display a unique reference for any subscription
  222. # Helpful for bank wire transfer identification
  223. SUBSCRIPTION_REFERENCE = 'REF-{subscription.offer.reference}-{subscription.pk}'
  224. # Template string to display the label the member should indicates for the bank
  225. # transfer
  226. MEMBERSHIP_REFERENCE = "ADH-{user.pk}"
  227. # Payment delay in days
  228. PAYMENT_DELAY = 30
  229. # Reset session if cookie older than 2h.
  230. SESSION_COOKIE_AGE = 7200
  231. # RSS/Atom feeds to display on dashboard
  232. # feed name (used in template), url, max entries to display
  233. # "isp" entry gets picked automatically in default index template
  234. FEEDS = (
  235. ('ffdn', 'http://www.ffdn.org/fr/rss.xml', 3),
  236. # ('isp', 'http://isp.example.com/feed/', 3),
  237. )
  238. # Account registration
  239. # Allow visitor to join the association by register on COIN
  240. REGISTRATION_OPEN = False
  241. # All account with unvalidated email will be deleted after X days
  242. ACCOUNT_ACTIVATION_DAYS = 7
  243. # Member can edit their own data
  244. MEMBER_CAN_EDIT_PROFILE = False
  245. # Allows to deactivate displays and calculations of balances.
  246. HANDLE_BALANCE = False
  247. # Add subscription comments in invoice items
  248. INVOICES_INCLUDE_CONFIG_COMMENTS = True