docker.py 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. # -*- coding:utf-8 -*-
  2. """
  3. Settings for Docker development
  4. Use this file as a base for your local development settings and copy
  5. it to umap/settings/local.py. It should not be checked into
  6. your code repository.
  7. """
  8. import environ
  9. from umap.settings.base import * # pylint: disable=W0614,W0401
  10. env = environ.Env()
  11. SECRET_KEY = env('SECRET_KEY')
  12. INTERNAL_IPS = env.list('INTERNAL_IPS', default='127.0.0.1')
  13. ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default='*')
  14. DEBUG = env.bool('DEBUG', default=False)
  15. ADMIN_EMAILS = env.list('ADMIN_EMAIL', default='')
  16. ADMINS = [(email, email) for email in ADMIN_EMAILS]
  17. MANAGERS = ADMINS
  18. DATABASES = {
  19. 'default': env.db(default='postgis://localhost:5432/umap')
  20. }
  21. COMPRESS_ENABLED = True
  22. COMPRESS_OFFLINE = True
  23. LANGUAGE_CODE = 'en'
  24. # Set to False if login into django account should not be possible. You can
  25. # administer accounts in the admin interface.
  26. ENABLE_ACCOUNT_LOGIN = env.bool('ENABLE_ACCOUNT_LOGIN', default=True)
  27. AUTHENTICATION_BACKENDS = ()
  28. # We need email to associate with other Oauth providers
  29. SOCIAL_AUTH_GITHUB_SCOPE = ['user:email']
  30. SOCIAL_AUTH_GITHUB_KEY = env('GITHUB_KEY', default='')
  31. SOCIAL_AUTH_GITHUB_SECRET = env('GITHUB_SECRET', default='')
  32. if SOCIAL_AUTH_GITHUB_KEY and SOCIAL_AUTH_GITHUB_SECRET:
  33. AUTHENTICATION_BACKENDS += (
  34. 'social_core.backends.github.GithubOAuth2',
  35. )
  36. SOCIAL_AUTH_BITBUCKET_KEY = env('BITBUCKET_KEY', default='')
  37. SOCIAL_AUTH_BITBUCKET_SECRET = env('BITBUCKET_SECRET', default='')
  38. if SOCIAL_AUTH_BITBUCKET_KEY and SOCIAL_AUTH_BITBUCKET_SECRET:
  39. AUTHENTICATION_BACKENDS += (
  40. 'social_core.backends.bitbucket.BitbucketOAuth',
  41. )
  42. SOCIAL_AUTH_TWITTER_KEY = env('TWITTER_KEY', default='')
  43. SOCIAL_AUTH_TWITTER_SECRET = env('TWITTER_SECRET', default='')
  44. if SOCIAL_AUTH_TWITTER_KEY and SOCIAL_AUTH_TWITTER_SECRET:
  45. AUTHENTICATION_BACKENDS += (
  46. 'social_core.backends.twitter.TwitterOAuth',
  47. )
  48. SOCIAL_AUTH_OPENSTREETMAP_KEY = env('OPENSTREETMAP_KEY', default='')
  49. SOCIAL_AUTH_OPENSTREETMAP_SECRET = env('OPENSTREETMAP_SECRET', default='')
  50. if SOCIAL_AUTH_OPENSTREETMAP_KEY and SOCIAL_AUTH_OPENSTREETMAP_SECRET:
  51. AUTHENTICATION_BACKENDS += (
  52. 'social_core.backends.openstreetmap.OpenStreetMapOAuth',
  53. )
  54. AUTHENTICATION_BACKENDS += (
  55. 'django.contrib.auth.backends.ModelBackend',
  56. )
  57. # MIDDLEWARE_CLASSES += (
  58. # 'social_django.middleware.SocialAuthExceptionMiddleware',
  59. # )
  60. SOCIAL_AUTH_RAISE_EXCEPTIONS = False
  61. SOCIAL_AUTH_BACKEND_ERROR_URL = "/"
  62. # If you want to add a playgroud map, add its primary key
  63. # UMAP_DEMO_PK = 204
  64. # If you want to add a showcase map on the home page, add its primary key
  65. # UMAP_SHOWCASE_PK = 1156
  66. # Add a baner to warn people this instance is not production ready.
  67. UMAP_DEMO_SITE = False
  68. # Whether to allow non authenticated people to create maps.
  69. LEAFLET_STORAGE_ALLOW_ANONYMOUS = env.bool(
  70. 'LEAFLET_STORAGE_ALLOW_ANONYMOUS',
  71. default=False,
  72. )
  73. # This setting will exclude empty maps (in fact, it will exclude all maps where
  74. # the default center has not been updated)
  75. UMAP_EXCLUDE_DEFAULT_MAPS = False
  76. # How many maps should be showcased on the main page resp. on the user page
  77. UMAP_MAPS_PER_PAGE = 0
  78. # How many maps should be showcased on the user page, if owner
  79. UMAP_MAPS_PER_PAGE_OWNER = 10
  80. SITE_URL = env('SITE_URL')
  81. SHORT_SITE_URL = env('SHORT_SITE_URL', default=None)
  82. CACHES = {'default': env.cache('REDIS_URL', default='locmem://')}
  83. # POSTGIS_VERSION = (2, 1, 0)
  84. EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
  85. # You need to unable accent extension before using UMAP_USE_UNACCENT
  86. # python manage.py dbshell
  87. # CREATE EXTENSION unaccent;
  88. UMAP_USE_UNACCENT = False
  89. # For static deployment
  90. STATIC_ROOT = '/srv/umap/static'
  91. # For users' statics (geojson mainly)
  92. MEDIA_ROOT = '/srv/umap/uploads'
  93. # Default map location for new maps
  94. LEAFLET_LONGITUDE = env.int('LEAFLET_LONGITUDE', default=2)
  95. LEAFLET_LATITUDE = env.int('LEAFLET_LATITUDE', default=51)
  96. LEAFLET_ZOOM = env.int('LEAFLET_ZOOM', default=6)
  97. # Number of old version to keep per datalayer.
  98. LEAFLET_STORAGE_KEEP_VERSIONS = env.int(
  99. 'LEAFLET_STORAGE_KEEP_VERSIONS',
  100. default=10,
  101. )
  102. import sys
  103. LOGGING = {
  104. 'version': 1,
  105. 'disable_existing_loggers': False,
  106. 'formatters': {
  107. 'verbose': {
  108. 'format': '[django] %(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
  109. }
  110. },
  111. 'handlers': {
  112. 'console': {
  113. 'level': 'DEBUG',
  114. 'class': 'logging.StreamHandler',
  115. 'stream': sys.stdout,
  116. 'formatter': 'verbose'
  117. },
  118. },
  119. 'loggers': {
  120. 'django': {
  121. 'handlers': ['console'],
  122. 'level': 'DEBUG',
  123. 'propagate': True,
  124. },
  125. },
  126. }