settings.py 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. # Django settings for parabolaweb project.
  2. from os import path
  3. ## Set the debug values
  4. DEBUG = False
  5. DEBUG_TOOLBAR = False
  6. ## Notification admins
  7. ADMINS = ()
  8. # Set managers to admins
  9. MANAGERS = ADMINS
  10. # Package out-of-date emails for orphans
  11. NOTIFICATIONS = ['dev@lists.parabola.nu']
  12. # Full path to the data directory
  13. DEPLOY_PATH = path.dirname(path.realpath(__file__))
  14. # If you set this to False, Django will not use timezone-aware datetimes.
  15. USE_TZ = True
  16. # Local time zone for this installation. Choices can be found here:
  17. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  18. # although not all choices may be available on all operating systems.
  19. TIME_ZONE = 'UTC'
  20. # Language code for this installation. All choices can be found here:
  21. # http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
  22. # http://blogs.law.harvard.edu/tech/stories/storyReader$15
  23. LANGUAGE_CODE = 'en-us'
  24. DEFAULT_CHARSET = 'utf-8'
  25. SITE_ID = 1
  26. # Default date format in templates for 'date' filter
  27. DATE_FORMAT = 'Y-m-d'
  28. DATETIME_FORMAT = 'Y-m-d H:i'
  29. # Login URL configuration
  30. LOGIN_URL = '/login/'
  31. LOGIN_REDIRECT_URL = '/'
  32. # Set django's User stuff to use our profile model
  33. AUTH_PROFILE_MODULE = 'devel.UserProfile'
  34. MIDDLEWARE_CLASSES = (
  35. 'django.middleware.common.CommonMiddleware',
  36. 'django.contrib.sessions.middleware.SessionMiddleware',
  37. 'django.middleware.csrf.CsrfViewMiddleware',
  38. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  39. 'django.contrib.messages.middleware.MessageMiddleware',
  40. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  41. 'django.middleware.http.ConditionalGetMiddleware',
  42. )
  43. # Base of the URL hierarchy
  44. ROOT_URLCONF = 'urls'
  45. # URL to serve static files
  46. STATIC_URL = '/static/'
  47. # Location to collect static files
  48. STATIC_ROOT = path.join(DEPLOY_PATH, 'collected_static')
  49. # Look for more static files in these locations
  50. STATICFILES_DIRS = (
  51. path.join(DEPLOY_PATH, 'sitestatic'),
  52. )
  53. # Static files backend that allows us to use far future Expires headers
  54. STATICFILES_STORAGE = 'main.storage.MinifiedStaticFilesStorage'
  55. # Configure where messages should reside
  56. MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
  57. # Session configuration
  58. SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
  59. SESSION_COOKIE_HTTPONLY = True
  60. # Clickjacking protection
  61. X_FRAME_OPTIONS = 'DENY'
  62. # Use new test runner
  63. TEST_RUNNER = 'django.test.runner.DiscoverRunner'
  64. INSTALLED_APPS = (
  65. 'django.contrib.auth',
  66. 'django.contrib.contenttypes',
  67. 'django.contrib.messages',
  68. 'django.contrib.sessions',
  69. 'django.contrib.sites',
  70. 'django.contrib.sitemaps',
  71. 'django.contrib.admin',
  72. 'django.contrib.staticfiles',
  73. 'django_countries',
  74. 'main',
  75. 'mirrors',
  76. 'news',
  77. 'packages',
  78. 'todolists',
  79. 'devel',
  80. 'public',
  81. 'releng',
  82. 'visualize',
  83. 'retro',
  84. )
  85. # Logging configuration for not getting overspammed
  86. LOGGING = {
  87. 'version': 1,
  88. 'filters': {
  89. 'ratelimit': {
  90. '()': 'main.log.RateLimitFilter',
  91. }
  92. },
  93. 'handlers': {
  94. 'mail_admins': {
  95. 'level': 'ERROR',
  96. 'filters': ['ratelimit'],
  97. 'class': 'django.utils.log.AdminEmailHandler',
  98. }
  99. },
  100. 'loggers': {
  101. 'django.request': {
  102. 'handlers': ['mail_admins'],
  103. 'level': 'ERROR',
  104. 'propagate': True,
  105. }
  106. },
  107. }
  108. ## Server used for linking to PGP keysearch results
  109. PGP_SERVER = 'pgp.mit.edu'
  110. PGP_SERVER_SECURE = True
  111. # URL where archweb is deployed
  112. WEB_URL = 'https://www.archlinux.org'
  113. # URL to fetch a current list of available ISOs
  114. ISO_LIST_URL = 'https://repo.parabola.nu/iso/'
  115. # URL for SVN access for fetching commit messages (note absence of packages or
  116. # community bit on the end, repo.svn_root is appended)
  117. #SVN_BASE_URL = 'svn://svn.archlinux.org/'
  118. # URL for linking to mailing lists
  119. MAILMAN_BASE_URL = 'https://lists.parabola.nu/'
  120. # Domain for mailman mailing lists
  121. MAILMAN_DOMAIN = 'lists.parabola.nu'
  122. # Email news items to NEWS_MAILINGLIST@MAILMAN_DOMAIN
  123. NEWS_MAILINGLIST = 'dev'
  124. # URL for linking to the bugtracker
  125. BUGTRACKER_URL = 'https://labs.parabola.nu/'
  126. # URL for linking to the release engineering/iso project on the bugtracker
  127. BUGTRACKER_RELENG_URL = 'https://labs.parabola.nu/projects/isos'
  128. # URL for linking to projects in git
  129. PROJECTS_URL = 'https://projects.parabola.nu'
  130. # Trackers used for ISO download magnet links
  131. TORRENT_TRACKERS = (
  132. 'udp://tracker.publicbt.com:80',
  133. 'udp://tracker.openbittorrent.com:80',
  134. 'udp://tracker.istole.it:80',
  135. )
  136. DOMAIN_RE = r'^(.+\.)?parabola(\.nu|gnulinux\.org)$'
  137. BRANDING_APPNAME = 'parabolaweb'
  138. BRANDING_DISTRONAME = 'Parabola GNU/Linux-libre'
  139. BRANDING_SHORTNAME = 'Parabola'
  140. BRANDING_SLUG = 'parabola'
  141. BRANDING_WIKINAME = 'ParabolaWiki'
  142. BRANDING_EMAIL = 'Parabola Website Notification <nobody@parabola.nu>'
  143. BRANDING_OSEARCH_TAGS = 'gnu linuxlibre parabola package software'
  144. # Shorten some names just a bit
  145. COUNTRIES_OVERRIDE = {
  146. 'GB': 'United Kingdom',
  147. 'US': 'United States',
  148. }
  149. # Make this unique, and don't share it with anybody.
  150. SECRET_KEY = '00000000000000000000000000000000000000000000000'
  151. DATABASES = {
  152. 'default': {
  153. 'ENGINE' : 'django.db.backends.sqlite3',
  154. 'NAME' : 'database.db',
  155. },
  156. }
  157. ## Import local settings
  158. try:
  159. from local_settings import *
  160. except ImportError:
  161. pass
  162. TEMPLATES = [
  163. {
  164. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  165. 'DIRS': [
  166. path.join(DEPLOY_PATH, 'templates')
  167. ],
  168. 'APP_DIRS': True,
  169. 'OPTIONS': {
  170. 'debug': DEBUG,
  171. 'context_processors': [
  172. 'django.contrib.auth.context_processors.auth',
  173. 'django.core.context_processors.debug',
  174. 'django.contrib.messages.context_processors.messages',
  175. 'main.context_processors.secure',
  176. 'main.context_processors.branding',
  177. ],
  178. }
  179. }
  180. ]
  181. # Enable the debug toolbar if requested
  182. if DEBUG_TOOLBAR:
  183. MIDDLEWARE_CLASSES = \
  184. [ 'debug_toolbar.middleware.DebugToolbarMiddleware' ] + \
  185. list(MIDDLEWARE_CLASSES)
  186. INSTALLED_APPS = list(INSTALLED_APPS) + [ 'debug_toolbar' ]
  187. # vim: set ts=4 sw=4 et: