diff --git a/pombola/settings/base.py b/pombola/settings/base.py index b193bd8b1..3859c99ca 100644 --- a/pombola/settings/base.py +++ b/pombola/settings/base.py @@ -17,12 +17,11 @@ IN_TEST_MODE = False # Work out where we are to set up the paths correctly and load config -base_dir = os.path.abspath(os.path.join( - os.path.split(__file__)[0], '..', '..')) +base_dir = os.path.abspath(os.path.join(os.path.split(__file__)[0], "..", "..")) # data_dir. If it's specified absolutely, respect it. # Otherwise assume it's relative to base_dir -conf_data_dir = os.environ.get('POMBOLA_DATADIR', 'data') +conf_data_dir = os.environ.get("POMBOLA_DATADIR", "data") if os.path.isabs(conf_data_dir): data_dir = conf_data_dir else: @@ -36,30 +35,25 @@ STAGING = DEBUG template_loaders = [ - 'django.template.loaders.app_directories.Loader', - 'django.template.loaders.filesystem.Loader', + "django.template.loaders.app_directories.Loader", + "django.template.loaders.filesystem.Loader", # 'django.template.loaders.eggs.Loader', ] if not DEBUG: - template_loaders = [ - ( - 'django.template.loaders.cached.Loader', - template_loaders - ) - ] + template_loaders = [("django.template.loaders.cached.Loader", template_loaders)] TEMPLATES = [ { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [ + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [ # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. - os.path.join(base_dir, 'pombola/templates') + os.path.join(base_dir, "pombola/templates") ], - 'OPTIONS': { - 'context_processors': [ + "OPTIONS": { + "context_processors": [ "django.contrib.auth.context_processors.auth", "django.template.context_processors.debug", "django.template.context_processors.i18n", @@ -69,20 +63,22 @@ "django.contrib.messages.context_processors.messages", "pombola.core.context_processors.add_settings", "pombola.core.context_processors.site_processor", - "constance.context_processors.config" + "constance.context_processors.config", ], - 'debug': DEBUG, + "debug": DEBUG, # List of callables that know how to import templates from various sources. - 'loaders': template_loaders, + "loaders": template_loaders, }, } ] if os.environ.get("ERRORS_EMAIL"): - ADMINS = (( - os.environ.get("ERRORS_NAME", "Pombola Developers"), - os.environ.get("ERRORS_EMAIL"), - ),) + ADMINS = ( + ( + os.environ.get("ERRORS_NAME", "Pombola Developers"), + os.environ.get("ERRORS_EMAIL"), + ), + ) SLUGGABLE_SLUGIFY_FUNCTION = slugify @@ -91,10 +87,12 @@ # This is the From: address used for error emails to ADMINS SERVER_EMAIL = DEFAULT_FROM_EMAIL -MANAGERS = (( - os.environ.get("MANAGERS_NAME", "Pombola Managers"), - os.environ.get("MANAGERS_EMAIL", "managers@example.com") -),) +MANAGERS = ( + ( + os.environ.get("MANAGERS_NAME", "Pombola Managers"), + os.environ.get("MANAGERS_EMAIL", "managers@example.com"), + ), +) db_config = dj_database_url.config() @@ -108,7 +106,7 @@ # Hosts/domain names that are valid for this site; required if DEBUG is False # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts -ALLOWED_HOSTS = ['*'] +ALLOWED_HOSTS = ["*"] # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name @@ -117,11 +115,11 @@ # timezone as the operating system. # If running in a Windows environment this must be set to the same as your # system time zone. -TIME_ZONE = os.environ.get("TIME_ZONE", 'Africa/Johannesburg') +TIME_ZONE = os.environ.get("TIME_ZONE", "Africa/Johannesburg") # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = 'en-GB' +LANGUAGE_CODE = "en-GB" SITE_ID = 1 @@ -135,7 +133,7 @@ # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/home/media/media.lawrence.com/media/" -MEDIA_ROOT = os.path.normpath(os.path.join(data_dir, 'media_root/')) +MEDIA_ROOT = os.path.normpath(os.path.join(data_dir, "media_root/")) # All uploaded files world-readable FILE_UPLOAD_PERMISSIONS = 0o644 # 'rw-r--r--' @@ -143,20 +141,20 @@ # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" -MEDIA_URL = '/media_root/' +MEDIA_URL = "/media_root/" # Use django-pipeline for handling static files -STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' +STATICFILES_STORAGE = "pipeline.storage.PipelineCachedStorage" # Absolute path to the directory static files should be collected to. # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. # Example: "/home/media/media.lawrence.com/static/" -STATIC_ROOT = os.path.normpath(os.path.join(data_dir, 'collected_static/')) +STATIC_ROOT = os.path.normpath(os.path.join(data_dir, "collected_static/")) # URL prefix for static files. # Example: "http://media.lawrence.com/static/" -STATIC_URL = '/static/' +STATIC_URL = "/static/" # Additional locations of static files STATICFILES_DIRS = ( @@ -169,12 +167,12 @@ # List of finder classes that know how to find static files in # various locations. STATICFILES_FINDERS = ( - 'django.contrib.staticfiles.finders.FileSystemFinder', - 'django.contrib.staticfiles.finders.AppDirectoriesFinder', + "django.contrib.staticfiles.finders.FileSystemFinder", + "django.contrib.staticfiles.finders.AppDirectoriesFinder", # 'pipeline.finders.FileSystemFinder', # 'pipeline.finders.AppDirectoriesFinder', - 'pipeline.finders.PipelineFinder', - 'pipeline.finders.CachedFileFinder', + "pipeline.finders.PipelineFinder", + "pipeline.finders.CachedFileFinder", ) # Make this unique, and don't share it with anybody. @@ -183,20 +181,20 @@ CACHES = { # by default use memcached locally. This is what get used by # django.core.cache.cache - 'default': { - 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', - 'LOCATION': '/var/tmp/django_cache', + "default": { + "BACKEND": "django.core.cache.backends.filebased.FileBasedCache", + "LOCATION": "/var/tmp/django_cache", }, # we also have a dummy cache that is used for all the page requests - we want # the cache framework to auto-add all the caching headers, but we don't actually # want to do the caching ourselves - rather we leave that to Varnish on the # servers. - 'dummy': { - 'BACKEND': 'django.core.cache.backends.dummy.DummyCache', + "dummy": { + "BACKEND": "django.core.cache.backends.dummy.DummyCache", }, } -CACHE_MIDDLEWARE_ALIAS = 'dummy' +CACHE_MIDDLEWARE_ALIAS = "dummy" if DEBUG: CACHE_MIDDLEWARE_SECONDS = 0 else: @@ -213,32 +211,32 @@ MIDDLEWARE_CLASSES = ( # first in list so it is able to act last on response - 'django.middleware.gzip.GZipMiddleware', + "django.middleware.gzip.GZipMiddleware", ) if os.environ.get("DJANGO_DEBUG_TOOLBAR", "false").lower() == "true": MIDDLEWARE_CLASSES += ("debug_toolbar.middleware.DebugToolbarMiddleware",) MIDDLEWARE_CLASSES += ( - 'corsheaders.middleware.CorsMiddleware', - 'django.middleware.cache.UpdateCacheMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.middleware.cache.FetchFromCacheMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'pagination.middleware.PaginationMiddleware', - 'mapit.middleware.ViewExceptionMiddleware', - 'django.middleware.security.SecurityMiddleware', + "corsheaders.middleware.CorsMiddleware", + "django.middleware.cache.UpdateCacheMiddleware", + "django.middleware.common.CommonMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", + "django.middleware.csrf.CsrfViewMiddleware", + "django.contrib.auth.middleware.AuthenticationMiddleware", + "django.middleware.cache.FetchFromCacheMiddleware", + "django.contrib.messages.middleware.MessageMiddleware", + "pagination.middleware.PaginationMiddleware", + "mapit.middleware.ViewExceptionMiddleware", + "django.middleware.security.SecurityMiddleware", ) CORS_ALLOW_HEADERS = default_headers + ("HTTP_AUTHORIZATION", "SENTRY-TRACE") -ROOT_URLCONF = 'pombola.urls' +ROOT_URLCONF = "pombola.urls" MAPIT_AREA_SRID = 4326 -MAPIT_RATE_LIMIT = ['127.0.0.1'] +MAPIT_RATE_LIMIT = ["127.0.0.1"] # MAPIT_COUNTRY should be set in the country-specific file # A sample logging configuration. The only tangible logging @@ -247,50 +245,48 @@ # See http://docs.djangoproject.com/en/dev/topics/logging for # more details on how to customize your logging configuration. LOGGING = { - 'version': 1, - 'disable_existing_loggers': False, - 'filters': { - 'require_debug_false': { - '()': 'django.utils.log.RequireDebugFalse' - }, - 'skip_unreadable_posts': { - '()': 'django.utils.log.CallbackFilter', - 'callback': skip_unreadable_post, + "version": 1, + "disable_existing_loggers": False, + "filters": { + "require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}, + "skip_unreadable_posts": { + "()": "django.utils.log.CallbackFilter", + "callback": skip_unreadable_post, }, }, - 'handlers': { - 'mail_admins': { - 'filters': ['require_debug_false', 'skip_unreadable_posts'], - 'level': 'DEBUG' if DEBUG else 'ERROR', - 'class': 'django.utils.log.AdminEmailHandler' + "handlers": { + "mail_admins": { + "filters": ["require_debug_false", "skip_unreadable_posts"], + "level": "DEBUG" if DEBUG else "ERROR", + "class": "django.utils.log.AdminEmailHandler", }, - 'stream_to_stderr': { - 'level': 'DEBUG' if DEBUG else 'WARN', - 'class': 'logging.StreamHandler', + "stream_to_stderr": { + "level": "DEBUG" if DEBUG else "WARN", + "class": "logging.StreamHandler", }, }, - 'loggers': { - 'django': { - 'handlers': ['stream_to_stderr'], - 'level': 'DEBUG' if DEBUG else 'INFO', - 'propagate': True, + "loggers": { + "django": { + "handlers": ["stream_to_stderr"], + "level": "DEBUG" if DEBUG else "INFO", + "propagate": True, }, - 'django.request': { - 'handlers': ['mail_admins'], - 'level': 'DEBUG' if DEBUG else 'ERROR', - 'propagate': True, + "django.request": { + "handlers": ["mail_admins"], + "level": "DEBUG" if DEBUG else "ERROR", + "propagate": True, }, - 'elasticsearch': { - 'handlers': ['stream_to_stderr'], - 'level': 'DEBUG' if DEBUG else 'INFO', - 'propagate': True, + "elasticsearch": { + "handlers": ["stream_to_stderr"], + "level": "DEBUG" if DEBUG else "INFO", + "propagate": True, }, - 'elasticsearch.trace': { - 'handlers': ['stream_to_stderr'], - 'level': 'DEBUG' if DEBUG else 'INFO', - 'propagate': True, + "elasticsearch.trace": { + "handlers": ["stream_to_stderr"], + "level": "DEBUG" if DEBUG else "INFO", + "propagate": True, }, - } + }, } # Configure the Hansard app @@ -316,80 +312,79 @@ # 'PATH': os.path.join( data_dir, 'pombola_xapian' ), # 'PATH': os.path.join(os.path.dirname(__file__), 'xapian_index'), # }, - 'default': { - 'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine', - 'URL': os.environ.get('ELASTICSEARCH_URL'), - 'INDEX_NAME': os.environ.get('ELASTICSEARCH_INDEX', 'pombola'), - 'EXCLUDED_INDEXES': [], - 'TIMEOUT': int(os.environ.get('ELASTICSEARCH_TIMEOUT', 10)), + "default": { + "ENGINE": "haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine", + "URL": os.environ.get("ELASTICSEARCH_URL"), + "INDEX_NAME": os.environ.get("ELASTICSEARCH_INDEX", "pombola"), + "EXCLUDED_INDEXES": [], + "TIMEOUT": int(os.environ.get("ELASTICSEARCH_TIMEOUT", 10)), } } if os.environ.get("ELASTICSEARCH_PASSWORD"): HAYSTACK_CONNECTIONS["default"]["KWARGS"] = { - 'http_auth': ( + "http_auth": ( os.environ.get("ELASTICSEARCH_USERNAME"), os.environ.get("ELASTICSEARCH_PASSWORD"), ), - 'port': os.environ.get("ELASTICSEARCH_PORT", 9200), - 'use_ssl': os.environ.get("ELASTICSEARCH_SSL"), + "port": os.environ.get("ELASTICSEARCH_PORT", 9200), + "use_ssl": os.environ.get("ELASTICSEARCH_SSL"), } -HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor' +HAYSTACK_SIGNAL_PROCESSOR = "haystack.signals.RealtimeSignalProcessor" # Admin autocomplete AJAX_LOOKUP_CHANNELS = { - 'person_name': ('pombola.core.lookups', 'PersonLookup'), - 'organisation_name': dict(model='core.organisation', search_field='name'), - 'place_name': dict(model='core.place', search_field='name'), - 'title_name': dict(model='core.positiontitle', search_field='name'), - 'sayit_section': dict(model='speeches.section', search_field='heading'), + "person_name": ("pombola.core.lookups", "PersonLookup"), + "organisation_name": dict(model="core.organisation", search_field="name"), + "place_name": dict(model="core.place", search_field="name"), + "title_name": dict(model="core.positiontitle", search_field="name"), + "sayit_section": dict(model="speeches.section", search_field="heading"), } # misc settings -HTTPLIB2_CACHE_DIR = os.path.join(data_dir, 'httplib2_cache') -GOOGLE_ANALYTICS_ACCOUNT = os.environ.get('GOOGLE_ANALYTICS_ACCOUNT', None) -GOOGLE_SITE_VERIFICATION = os.environ.get('GOOGLE_SITE_VERIFICATION', None) +HTTPLIB2_CACHE_DIR = os.path.join(data_dir, "httplib2_cache") +GOOGLE_ANALYTICS_ACCOUNT = os.environ.get("GOOGLE_ANALYTICS_ACCOUNT", None) +GOOGLE_SITE_VERIFICATION = os.environ.get("GOOGLE_SITE_VERIFICATION", None) # Markitup settings -MARKITUP_FILTER = ('markdown.markdown', { - 'safe_mode': True, 'extensions': ['tables']}) -MARKITUP_SET = 'markitup/sets/markdown' -JQUERY_URL = 'https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js' +MARKITUP_FILTER = ("markdown.markdown", {"safe_mode": True, "extensions": ["tables"]}) +MARKITUP_SET = "markitup/sets/markdown" +JQUERY_URL = "https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js" # Use nose as the test runner -TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' -NOSE_ARGS = ['--with-doctest', '--with-yanc'] +TEST_RUNNER = "django_nose.NoseTestSuiteRunner" +NOSE_ARGS = ["--with-doctest", "--with-yanc"] # For the disqus comments -DISQUS_SHORTNAME = os.environ.get('DISQUS_SHORTNAME', None) +DISQUS_SHORTNAME = os.environ.get("DISQUS_SHORTNAME", None) # At some point we should deprecate this. For now it defaults to true so that # no entry in the config does the right thing. -DISQUS_USE_IDENTIFIERS = os.environ.get('DISQUS_USE_IDENTIFIERS', True) -FACEBOOK_APP_ID = os.environ.get('FACEBOOK_APP_ID', None) +DISQUS_USE_IDENTIFIERS = os.environ.get("DISQUS_USE_IDENTIFIERS", True) +FACEBOOK_APP_ID = os.environ.get("FACEBOOK_APP_ID", None) # Polldaddy widget ID - from http://polldaddy.com/ # Use the widget rather than embedding a poll direct as it will allow the poll # to be changed without having to alter the settings or HTML. If left blank # then no poll will be shown. -POLLDADDY_WIDGET_ID = os.environ.get('POLLDADDY_WIDGET_ID', None) +POLLDADDY_WIDGET_ID = os.environ.get("POLLDADDY_WIDGET_ID", None) # RSS feed to the blog related to this site. If present will cause the 'Latest # News' to appear on the homepage. -BLOG_RSS_FEED = os.environ.get('BLOG_RSS_FEED', None) +BLOG_RSS_FEED = os.environ.get("BLOG_RSS_FEED", None) THUMBNAIL_DEBUG = True # ZA Hansard settings -HANSARD_CACHE = os.path.join(data_dir, 'hansard_cache') -COMMITTEE_CACHE = os.path.join(HANSARD_CACHE, 'committee') -ANSWER_CACHE = os.path.join(HANSARD_CACHE, 'answers') -QUESTION_CACHE = os.path.join(HANSARD_CACHE, 'questions') -ANSWER_JSON_CACHE = os.path.join(HANSARD_CACHE, 'answers_json') -QUESTION_JSON_CACHE = os.path.join(HANSARD_CACHE, 'questions_json') +HANSARD_CACHE = os.path.join(data_dir, "hansard_cache") +COMMITTEE_CACHE = os.path.join(HANSARD_CACHE, "committee") +ANSWER_CACHE = os.path.join(HANSARD_CACHE, "answers") +QUESTION_CACHE = os.path.join(HANSARD_CACHE, "questions") +ANSWER_JSON_CACHE = os.path.join(HANSARD_CACHE, "answers_json") +QUESTION_JSON_CACHE = os.path.join(HANSARD_CACHE, "questions_json") PMG_COMMITTEE_USER = os.environ.get("PMG_COMMITTEE_USER", "") PMG_COMMITTEE_PASS = os.environ.get("PMG_COMMITTEE_PASS", "") @@ -409,76 +404,61 @@ POPIT_API_URL = "/help/api" BREADCRUMB_URL_NAME_MAPPINGS = { - 'info': ('Information', '/info/'), - 'organisation': ('Organisations', '/organisation/all/'), - 'person': ('Politicians', '/person/all/'), - 'place': ('Places', '/place/all/'), - 'search': ('Search', '/search/'), + "info": ("Information", "/info/"), + "organisation": ("Organisations", "/organisation/all/"), + "person": ("Politicians", "/person/all/"), + "place": ("Places", "/place/all/"), + "search": ("Search", "/search/"), } # Info page settings INFO_POSTS_PER_LIST_PAGE = 10 INSTALLED_APPS = ( - 'corsheaders', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'django.contrib.humanize', - 'django.contrib.gis', - - 'constance.backends.database', - 'constance', - - 'pombola.admin_additions', - 'autocomplete_light', - 'django.contrib.admin', - 'django.contrib.admindocs', - - 'ajax_select', - 'markitup', - - 'pipeline', - - 'mapit', - - 'popolo', - - 'images', + "corsheaders", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.sites", + "django.contrib.messages", + "django.contrib.staticfiles", + "django.contrib.humanize", + "django.contrib.gis", + "constance.backends.database", + "constance", + "pombola.admin_additions", + "autocomplete_light", + "django.contrib.admin", + "django.contrib.admindocs", + "ajax_select", + "markitup", + "pipeline", + "mapit", + "popolo", + "images", # easy_thumbnails is required by SayIt; it needs to be in # INSTALLED_APPS so that its table is created so that we can # create SayIt speakers. It should be after sorl.thumbnails so # that sorl.thumbnails (used by Pombola) is what's loaded when # Pombola templates do {% load thumbnail %} - 'easy_thumbnails', - 'sorl.thumbnail', - - 'haystack', - - 'slug_helpers', - 'info', - - 'pombola.tasks', - 'pombola.core', - 'pombola.feedback', - 'pombola.scorecards', - 'pombola.search', - 'file_archive', - 'pombola.map', - 'pombola.experiments', - 'pombola.budgets', - - 'pagination', - 'django_nose', - 'django_extensions', - - 'rest_framework', - - - + "easy_thumbnails", + "sorl.thumbnail", + "haystack", + "slug_helpers", + "info", + "pombola.tasks", + "pombola.core", + "pombola.feedback", + "pombola.scorecards", + "pombola.search", + "file_archive", + "pombola.map", + "pombola.experiments", + "pombola.budgets", + "pagination", + "django_nose", + "django_extensions", + "rest_framework", ) if os.environ.get("DJANGO_DEBUG_TOOLBAR", "true").lower() == "true": INSTALLED_APPS += ("debug_toolbar",) @@ -501,9 +481,8 @@ def insert_after(sequence, existing_item, item_to_put_after): def make_enabled_features(installed_apps, all_optional_apps): result = {} for key in all_optional_apps: - key = re.sub(r'^pombola\.', '', key) - result[key] = ( - 'pombola.' + key in installed_apps) or (key in installed_apps) + key = re.sub(r"^pombola\.", "", key) + result[key] = ("pombola." + key in installed_apps) or (key in installed_apps) return result @@ -512,119 +491,107 @@ def make_enabled_features(installed_apps, all_optional_apps): # PIPELINE_ENABLED = True PIPELINE = { - 'COMPILERS': ("pipeline_compass.compass.CompassCompiler",), - 'CSS_COMPRESSOR': "pombola.pipeline.compressor.LoggingYUICompressor", - 'JS_COMPRESSOR': "pombola.pipeline.compressor.LoggingYUICompressor", - 'YUI_BINARY': "/usr/bin/env yui-compressor", - 'DISABLE_WRAPPER': True + "COMPILERS": ("pipeline_compass.compass.CompassCompiler",), + "CSS_COMPRESSOR": "pombola.pipeline.compressor.LoggingYUICompressor", + "JS_COMPRESSOR": "pombola.pipeline.compressor.LoggingYUICompressor", + "YUI_BINARY": "/usr/bin/env yui-compressor", + "DISABLE_WRAPPER": True, } # Set up the core CSS and JS f,iles: default_stylesheet_extra_content = { - 'media': 'all', - 'charset': None, - 'title': None, + "media": "all", + "charset": None, + "title": None, } -PIPELINE['STYLESHEETS'] = { - 'countdown': { - 'source_filenames': ( - 'css/jquery.countdown-v1.6.0.css', - 'sass/countdown.scss', +PIPELINE["STYLESHEETS"] = { + "countdown": { + "source_filenames": ( + "css/jquery.countdown-v1.6.0.css", + "sass/countdown.scss", ), - 'output_filename': 'css/countdown.css', - 'extra_context': default_stylesheet_extra_content, + "output_filename": "css/countdown.css", + "extra_context": default_stylesheet_extra_content, }, - 'admin': { - 'source_filenames': ( + "admin": { + "source_filenames": ( # .scss files from core: - 'sass/admin.scss', + "sass/admin.scss", ), - 'output_filename': 'css/admin.css', - 'extra_context': default_stylesheet_extra_content, + "output_filename": "css/admin.css", + "extra_context": default_stylesheet_extra_content, }, } default_js_extra_content = { - 'async': False, - 'defer': False, + "async": False, + "defer": False, } -PIPELINE['JAVASCRIPT'] = { - 'base': { - 'source_filenames': ( - 'js/libs/jquery-ui.js', - 'js/libs/jquery.form-v2.94.js', - 'js/functions.js', - 'js/hover-dropdown.js', - 'js/twitter-embed.js', - 'js/analytics.js', +PIPELINE["JAVASCRIPT"] = { + "base": { + "source_filenames": ( + "js/libs/jquery-ui.js", + "js/libs/jquery.form-v2.94.js", + "js/functions.js", + "js/hover-dropdown.js", + "js/twitter-embed.js", + "js/analytics.js", ), - 'output_filename': 'js/base.js', - 'extra_context': default_js_extra_content, + "output_filename": "js/base.js", + "extra_context": default_js_extra_content, }, - 'load-appearances': { - 'source_filenames': ( - 'js/load-appearances.html', - ), - 'output_filename': 'js/load-appearances.js', - 'extra_context': default_js_extra_content, + "load-appearances": { + "source_filenames": ("js/load-appearances.html",), + "output_filename": "js/load-appearances.js", + "extra_context": default_js_extra_content, }, - 'feeds': { - 'source_filenames': ( - 'js/feeds.js', - ), - 'output_filename': 'js/feeds.js', - 'extra_context': default_js_extra_content, + "feeds": { + "source_filenames": ("js/feeds.js",), + "output_filename": "js/feeds.js", + "extra_context": default_js_extra_content, }, - 'responsive-carousel': { - 'source_filenames': ( - 'js/libs/responsive-carousel.js', - ), - 'output_filename': 'js/responsive-carousel.js', - 'extra_context': default_js_extra_content, + "responsive-carousel": { + "source_filenames": ("js/libs/responsive-carousel.js",), + "output_filename": "js/responsive-carousel.js", + "extra_context": default_js_extra_content, }, - 'map': { - 'source_filenames': ( - 'js/map-drilldown.js', - ), - 'output_filename': 'js/base-map-drilldown.js', - 'extra_context': default_js_extra_content, + "map": { + "source_filenames": ("js/map-drilldown.js",), + "output_filename": "js/base-map-drilldown.js", + "extra_context": default_js_extra_content, }, - 'ui-test': { - 'source_filenames': ( - 'js/ui-test.js', - ), - 'output_filename': 'js/ui-test.js', - 'extra_context': default_js_extra_content, + "ui-test": { + "source_filenames": ("js/ui-test.js",), + "output_filename": "js/ui-test.js", + "extra_context": default_js_extra_content, }, - 'google-map': { - 'source_filenames': ( - 'js/map.js', - ), - 'output_filename': 'js/google-map.js', - 'extra_context': default_js_extra_content, + "google-map": { + "source_filenames": ("js/map.js",), + "output_filename": "js/google-map.js", + "extra_context": default_js_extra_content, }, - 'modernizr': { - 'source_filenames': ('js/libs/modernizr.js',), - 'output_filename': 'js/modernizr.js', - 'extra_context': default_js_extra_content, + "modernizr": { + "source_filenames": ("js/libs/modernizr.js",), + "output_filename": "js/modernizr.js", + "extra_context": default_js_extra_content, }, - 'respond': { - 'source_filenames': ('js/libs/respond.1.4.2.js',), - 'output_filename': 'js/respond.js', - 'extra_context': default_js_extra_content, + "respond": { + "source_filenames": ("js/libs/respond.1.4.2.js",), + "output_filename": "js/respond.js", + "extra_context": default_js_extra_content, }, - 'hide-reveal': { - 'source_filenames': ('js/hide-reveal.js',), - 'output_filename': 'js/hide-reveal.js', - 'extra_context': default_js_extra_content, + "hide-reveal": { + "source_filenames": ("js/hide-reveal.js",), + "output_filename": "js/hide-reveal.js", + "extra_context": default_js_extra_content, }, - 'survey': { - 'source_filenames': ('js/survey.js',), - 'output_filename': 'js/survey.js', - 'extra_context': default_js_extra_content, + "survey": { + "source_filenames": ("js/survey.js",), + "output_filename": "js/survey.js", + "extra_context": default_js_extra_content, }, } @@ -672,7 +639,7 @@ def make_enabled_features(installed_apps, all_optional_apps): EMAIL_PORT = port EMAIL_USE_TLS = os.environ.get("EMAIL_USE_TLS", True) elif DEBUG or os.environ.get("EMAIL_DISABLED", "false").lower() == "true": - EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" # Django Rest Framework settings: REST_FRAMEWORK = { @@ -699,8 +666,7 @@ def make_enabled_features(installed_apps, all_optional_apps): "place_data": "place_data", } -GOOGLE_MAPS_GEOCODING_API_KEY = os.environ.get( - "GOOGLE_MAPS_GEOCODING_API_KEY", "") +GOOGLE_MAPS_GEOCODING_API_KEY = os.environ.get("GOOGLE_MAPS_GEOCODING_API_KEY", "") GOOGLE_RECAPTCHA_SITE_KEY = os.environ.get("GOOGLE_RECAPTCHA_SITE_KEY", "") GOOGLE_RECAPTCHA_SECRET_KEY = os.environ.get("GOOGLE_RECAPTCHA_SECRET_KEY", "") @@ -711,13 +677,13 @@ def show_toolbar(request): DEBUG_TOOLBAR_CONFIG = { - 'SHOW_TOOLBAR_CALLBACK': show_toolbar, + "SHOW_TOOLBAR_CALLBACK": show_toolbar, } # Constance -CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend' +CONSTANCE_BACKEND = "constance.backends.database.DatabaseBackend" CONSTANCE_CONFIG = { - 'SHOW_SURVEY': (False, 'Show survey link on homepage'), + "SHOW_SURVEY": (False, "Show survey link on homepage"), } # Sentry @@ -728,6 +694,6 @@ def show_toolbar(request): integrations=[DjangoIntegration()], environment=os.environ.get("ENVIRONMENT"), traces_sample_rate=os.environ.get("SENTRY_TRACES_SAMPLE_RATE", 1.0), - profiles_sample_rate=os.environ.get( - "SENTRY_PROFILES_SAMPLE_RATE", 1.0), + profiles_sample_rate=os.environ.get("SENTRY_PROFILES_SAMPLE_RATE", 1.0), + send_default_pii=True, )