We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Should we set DEFAULT_AUTO_FIELD?
Related to the Django 3.2 upgrade. Just thought this should be a conscious documented discussion rather than an informal one, since there seem to be (minor but nontrivial) consequences.

https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-created-primary-keys:
> Maintaining the historical behavior, the default value for `DEFAULT_AUTO_FIELD` is `AutoField`. Starting with 3.2 new projects are generated with `DEFAULT_AUTO_FIELD` set to `BigAutoField`. Also, new apps are generated with `AppConfig.default_auto_field` set to `BigAutoField`. In a future Django release the default value of `DEFAULT_AUTO_FIELD` will be changed to `BigAutoField`.

But migrations aren't seamless. https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-DEFAULT_AUTO_FIELD:
> Unfortunately, the primary keys of existing auto-created through tables cannot currently be updated by the migrations framework.
> 
> This means that if you switch the value of `DEFAULT_AUTO_FIELD` and then generate migrations, the primary keys of the related models will be updated, as will the foreign keys from the through table, but the primary key of the auto-created through table will not be migrated.

To me the path of least resistance would be to set `DEFAULT_AUTO_FIELD` to `AutoField`, and kick the `BigAutoField` can down the road until (maybe) migrations work for it without manually added code, or until it becomes necessary. I can't imagine hitting 2 billion entries (what I presume the `AutoField` limit would be) in a table in a Tabbycat instance any time soon. But there's nothing prohibitive about `BigAutoField` migration, if others would prefer to get this change out of the way.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `tabbycat/settings/core.py`
Content:
```
1 import os
2 
3 from django.contrib.messages import constants as messages
4 from django.utils.translation import gettext_lazy as _
5 
6 
7 BASE_DIR = os.path.dirname(os.path.abspath(os.path.join(__file__, os.pardir)))
8 MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
9 
10 # ==============================================================================
11 # Overwritten in local.py or heroku.py
12 # ==============================================================================
13 
14 ADMINS = ('Philip and Chuan-Zheng', 'tabbycat@philipbelesky.com'),
15 MANAGERS = ADMINS
16 DEBUG = bool(int(os.environ['DEBUG'])) if 'DEBUG' in os.environ else False
17 ENABLE_DEBUG_TOOLBAR = False # Must default to false; overriden in Dev config
18 DISABLE_SENTRY = True # Overriden in Heroku config
19 SECRET_KEY = r'#2q43u&tp4((4&m3i8v%w-6z6pp7m(v0-6@w@i!j5n)n15epwc'
20 
21 # ==============================================================================
22 # Version
23 # ==============================================================================
24 
25 TABBYCAT_VERSION = '2.6.0-dev'
26 TABBYCAT_CODENAME = 'Ocicat'
27 READTHEDOCS_VERSION = 'v2.6.0-dev'
28 
29 # ==============================================================================
30 # Internationalization and Localization
31 # ==============================================================================
32 
33 USE_I18N = True
34 USE_TZ = True
35 USE_L10N = True
36 LANGUAGE_CODE = 'en'
37 TIME_ZONE = os.environ.get('TIME_ZONE', 'Australia/Melbourne')
38 
39 LOCALE_PATHS = [
40     os.path.join(BASE_DIR, 'locale'),
41 ]
42 
43 # Languages that should be available in the switcher
44 EXTRA_LANG_INFO = {
45     'ms': {
46         'bidi': False,
47         'code': 'ms',
48         'name': 'Malay',
49         'name_local': 'Bahasa Melayu', #unicode codepoints here
50     },
51     'tzl': {
52         # Use code for Talossan; can't use proper reserved code...
53         # Talossan is a constructed language, without native speakers,
54         # so the odds of having a translation are low.
55         'code': 'tzl',
56         'name': 'Translation',
57         'name_local': 'Translation',
58     },
59 }
60 
61 # Add custom languages not provided by Django
62 import django.conf.locale
63 LANG_INFO = dict(django.conf.locale.LANG_INFO, **EXTRA_LANG_INFO)
64 django.conf.locale.LANG_INFO = LANG_INFO
65 
66 LANGUAGES = [
67     ('ar', _('Arabic')),
68     ('bn', _('Bengali')),
69     ('en', _('English')),
70     ('es', _('Spanish')),
71     ('fr', _('French')),
72     ('id', _('Indonesian')),
73     ('ja', _('Japanese')),
74     ('ms', _('Malay')),
75     ('pt', _('Portuguese')),
76     ('ru', _('Russian')),
77     ('zh-hans', _('Simplified Chinese')),
78     ('tzl', _('Translation')),
79 ]
80 
81 STATICI18N_ROOT = os.path.join(BASE_DIR, "locale")
82 
83 FORMAT_MODULE_PATH = [
84     'utils.formats',
85 ]
86 
87 # ==============================================================================
88 # Django-specific Modules
89 # ==============================================================================
90 
91 MIDDLEWARE = [
92     'django.middleware.gzip.GZipMiddleware',
93     'django.middleware.security.SecurityMiddleware',
94     'django.contrib.sessions.middleware.SessionMiddleware',
95     # User language preferences; must be after Session
96     'django.middleware.locale.LocaleMiddleware',
97     # Set Etags; i.e. cached requests not on network; must precede Common
98     'corsheaders.middleware.CorsMiddleware',
99     'django.middleware.http.ConditionalGetMiddleware',
100     'django.middleware.common.CommonMiddleware',
101     # Must be after SessionMiddleware
102     'django.contrib.auth.middleware.AuthenticationMiddleware',
103     'django.contrib.messages.middleware.MessageMiddleware',
104     'django.middleware.clickjacking.XFrameOptionsMiddleware',
105     'utils.middleware.DebateMiddleware',
106 ]
107 
108 TABBYCAT_APPS = (
109     'actionlog',
110     'adjallocation',
111     'adjfeedback',
112     'api',
113     'availability',
114     'breakqual',
115     'checkins',
116     'divisions', # obsolete
117     'draw',
118     'motions',
119     'options',
120     'participants',
121     'printing',
122     'privateurls',
123     'results',
124     'tournaments',
125     'venues',
126     'utils',
127     'users',
128     'standings',
129     'notifications',
130     'importer',
131 )
132 
133 INSTALLED_APPS = (
134     'jet',
135     'django.contrib.admin',
136     'django.contrib.auth',
137     'django.contrib.contenttypes',
138     'django.contrib.sessions',
139     'channels', # For Websockets / real-time connections (above whitenoise)
140     'django.contrib.staticfiles',
141     'django.contrib.humanize',
142     'django_summernote',  # Keep above our apps; as we unregister an admin model
143     'django.contrib.messages') \
144     + TABBYCAT_APPS + (
145     'dynamic_preferences',
146     'django_extensions',  # For Secret Generation Command
147     'gfklookupwidget',
148     'formtools',
149     'statici18n', # Compile js translations as static file; saving requests
150     'polymorphic',
151     'corsheaders',
152     'rest_framework',
153     'rest_framework.authtoken',
154     'django_better_admin_arrayfield',
155 )
156 
157 ROOT_URLCONF = 'urls'
158 LOGIN_REDIRECT_URL = '/'
159 LOGOUT_REDIRECT_URL = '/'
160 FIXTURE_DIRS = (os.path.join(os.path.dirname(BASE_DIR), 'data', 'fixtures'), )
161 SILENCED_SYSTEM_CHECKS = ('urls.W002',)
162 
163 # ==============================================================================
164 # Templates
165 # ==============================================================================
166 
167 TEMPLATES = [
168     {
169         'BACKEND': 'django.template.backends.django.DjangoTemplates',
170         'DIRS': [os.path.join(BASE_DIR, 'templates')],
171         'OPTIONS': {
172             'context_processors': [
173                 'django.contrib.auth.context_processors.auth',
174                 'django.contrib.messages.context_processors.messages',
175                 'django.template.context_processors.debug',
176                 'django.template.context_processors.i18n',
177                 'django.template.context_processors.media',
178                 'django.template.context_processors.static',
179                 'django.template.context_processors.tz',
180                 'django.template.context_processors.request',  # for Jet
181                 'utils.context_processors.debate_context',  # for tournament config vars
182                 'django.template.context_processors.i18n',  # for serving static language translations
183                 'dynamic_preferences.processors.global_preferences',
184             ],
185             'loaders': [
186                 ('django.template.loaders.cached.Loader', [
187                     'django.template.loaders.filesystem.Loader',
188                     'django.template.loaders.app_directories.Loader',
189                 ]),
190             ],
191         }
192     },
193 ]
194 
195 # ==============================================================================
196 # Caching
197 # ==============================================================================
198 
199 PUBLIC_FAST_CACHE_TIMEOUT = int(os.environ.get('PUBLIC_FAST_CACHE_TIMEOUT', 60 * 1))
200 PUBLIC_SLOW_CACHE_TIMEOUT = int(os.environ.get('PUBLIC_SLOW_CACHE_TIMEOUT', 60 * 3.5))
201 TAB_PAGES_CACHE_TIMEOUT = int(os.environ.get('TAB_PAGES_CACHE_TIMEOUT', 60 * 120))
202 
203 # Default non-heroku cache is to use local memory
204 CACHES = {
205     'default': {
206         'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
207     },
208 }
209 
210 SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
211 
212 # ==============================================================================
213 # Static Files and Compilation
214 # ==============================================================================
215 
216 STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
217 STATIC_URL = '/static/'
218 
219 STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'), )
220 
221 STATICFILES_FINDERS = (
222     'django.contrib.staticfiles.finders.FileSystemFinder',
223     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
224 )
225 
226 STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
227 
228 # ==============================================================================
229 # Logging
230 # ==============================================================================
231 
232 MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
233 
234 LOGGING = {
235     'version': 1,
236     'disable_existing_loggers': False,
237     'handlers': {
238         'console': {
239             'class': 'logging.StreamHandler',
240             'formatter': 'standard',
241         },
242     },
243     'loggers': {
244         'django': {
245             'handlers': ['console'],
246             'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
247         },
248         'sentry.errors': {
249             'level': 'INFO',
250             'handlers': ['console'],
251             'propagate': False,
252         },
253     },
254     'formatters': {
255         'standard': {
256             'format': '[%(asctime)s] %(levelname)s %(name)s: %(message)s',
257         },
258     },
259 }
260 
261 for app in TABBYCAT_APPS:
262     LOGGING['loggers'][app] = {
263         'handlers': ['console'],
264         'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
265     }
266 
267 # ==============================================================================
268 # Messages
269 # ==============================================================================
270 
271 MESSAGE_TAGS = {messages.ERROR: 'danger', }
272 
273 # ==============================================================================
274 # Summernote (WYSWIG)
275 # ==============================================================================
276 
277 SUMMERNOTE_THEME = 'bs4' # Bootstrap 4
278 
279 SUMMERNOTE_CONFIG = {
280     'width': '100%',
281     'height': '480',
282     'toolbar': [
283         ['style', ['bold', 'italic', 'underline', 'fontsize', 'color', 'clear']],
284         ['para', ['ul', 'ol']],
285         ['insert', ['link', 'picture']],
286         ['misc', ['undo', 'redo', 'codeview']],
287     ],
288     'disable_upload': True,
289     'iframe': True, # Necessary; if just to compartmentalise jQuery dependency,
290 }
291 
292 X_FRAME_OPTIONS = 'SAMEORIGIN' # Necessary to get Django-Summernote working because of Django 3 changes
293 
294 # ==============================================================================
295 # Database
296 # ==============================================================================
297 
298 DATABASES = {
299     'default': {
300         'ENGINE': 'django.db.backends.postgresql',
301     },
302 }
303 
304 # ==============================================================================
305 # Channels
306 # ==============================================================================
307 
308 ASGI_APPLICATION = "routing.application"
309 
310 CHANNEL_LAYERS = {
311     "default": {
312         "BACKEND": "channels.layers.InMemoryChannelLayer",
313     },
314 }
315 
316 # ==============================================================================
317 # Dynamic preferences
318 # ==============================================================================
319 
320 DYNAMIC_PREFERENCES = {
321     'REGISTRY_MODULE': 'preferences',
322 }
323 
324 # ==============================================================================
325 # REST Framework
326 # ==============================================================================
327 
328 REST_FRAMEWORK = {
329     'DEFAULT_RENDERER_CLASSES': [
330         'rest_framework.renderers.JSONRenderer',
331     ],
332     'DEFAULT_PARSER_CLASSES': [
333         'rest_framework.parsers.JSONParser',
334     ],
335     'DEFAULT_AUTHENTICATION_CLASSES': [
336         'rest_framework.authentication.TokenAuthentication',
337     ],
338     'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
339 }
340 
341 # ----------------------------------------
342 # CORS-related settings for REST framework
343 # ----------------------------------------
344 
345 CORS_ALLOW_ALL_ORIGINS = True
346 CORS_URLS_REGEX = r'^/api(/.*)?$'
347
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/tabbycat/settings/core.py b/tabbycat/settings/core.py
--- a/tabbycat/settings/core.py
+++ b/tabbycat/settings/core.py
@@ -301,6 +301,8 @@
     },
 }
 
+DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
+
 # ==============================================================================
 # Channels
 # ==============================================================================

{"golden_diff": "diff --git a/tabbycat/settings/core.py b/tabbycat/settings/core.py\n--- a/tabbycat/settings/core.py\n+++ b/tabbycat/settings/core.py\n@@ -301,6 +301,8 @@\n     },\n }\n \n+DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'\n+\n # ==============================================================================\n # Channels\n # ==============================================================================\n", "issue": "Should we set DEFAULT_AUTO_FIELD?\nRelated to the Django 3.2 upgrade. Just thought this should be a conscious documented discussion rather than an informal one, since there seem to be (minor but nontrivial) consequences.\r\n\r\nhttps://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-created-primary-keys:\r\n> Maintaining the historical behavior, the default value for `DEFAULT_AUTO_FIELD` is `AutoField`. Starting with 3.2 new projects are generated with `DEFAULT_AUTO_FIELD` set to `BigAutoField`. Also, new apps are generated with `AppConfig.default_auto_field` set to `BigAutoField`. In a future Django release the default value of `DEFAULT_AUTO_FIELD` will be changed to `BigAutoField`.\r\n\r\nBut migrations aren't seamless. https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-DEFAULT_AUTO_FIELD:\r\n> Unfortunately, the primary keys of existing auto-created through tables cannot currently be updated by the migrations framework.\r\n> \r\n> This means that if you switch the value of `DEFAULT_AUTO_FIELD` and then generate migrations, the primary keys of the related models will be updated, as will the foreign keys from the through table, but the primary key of the auto-created through table will not be migrated.\r\n\r\nTo me the path of least resistance would be to set `DEFAULT_AUTO_FIELD` to `AutoField`, and kick the `BigAutoField` can down the road until (maybe) migrations work for it without manually added code, or until it becomes necessary. I can't imagine hitting 2 billion entries (what I presume the `AutoField` limit would be) in a table in a Tabbycat instance any time soon. But there's nothing prohibitive about `BigAutoField` migration, if others would prefer to get this change out of the way.\n", "before_files": [{"content": "import os\n\nfrom django.contrib.messages import constants as messages\nfrom django.utils.translation import gettext_lazy as _\n\n\nBASE_DIR = os.path.dirname(os.path.abspath(os.path.join(__file__, os.pardir)))\nMEDIA_ROOT = os.path.join(BASE_DIR, 'media')\n\n# ==============================================================================\n# Overwritten in local.py or heroku.py\n# ==============================================================================\n\nADMINS = ('Philip and Chuan-Zheng', 'tabbycat@philipbelesky.com'),\nMANAGERS = ADMINS\nDEBUG = bool(int(os.environ['DEBUG'])) if 'DEBUG' in os.environ else False\nENABLE_DEBUG_TOOLBAR = False # Must default to false; overriden in Dev config\nDISABLE_SENTRY = True # Overriden in Heroku config\nSECRET_KEY = r'#2q43u&tp4((4&m3i8v%w-6z6pp7m(v0-6@w@i!j5n)n15epwc'\n\n# ==============================================================================\n# Version\n# ==============================================================================\n\nTABBYCAT_VERSION = '2.6.0-dev'\nTABBYCAT_CODENAME = 'Ocicat'\nREADTHEDOCS_VERSION = 'v2.6.0-dev'\n\n# ==============================================================================\n# Internationalization and Localization\n# ==============================================================================\n\nUSE_I18N = True\nUSE_TZ = True\nUSE_L10N = True\nLANGUAGE_CODE = 'en'\nTIME_ZONE = os.environ.get('TIME_ZONE', 'Australia/Melbourne')\n\nLOCALE_PATHS = [\n    os.path.join(BASE_DIR, 'locale'),\n]\n\n# Languages that should be available in the switcher\nEXTRA_LANG_INFO = {\n    'ms': {\n        'bidi': False,\n        'code': 'ms',\n        'name': 'Malay',\n        'name_local': 'Bahasa Melayu', #unicode codepoints here\n    },\n    'tzl': {\n        # Use code for Talossan; can't use proper reserved code...\n        # Talossan is a constructed language, without native speakers,\n        # so the odds of having a translation are low.\n        'code': 'tzl',\n        'name': 'Translation',\n        'name_local': 'Translation',\n    },\n}\n\n# Add custom languages not provided by Django\nimport django.conf.locale\nLANG_INFO = dict(django.conf.locale.LANG_INFO, **EXTRA_LANG_INFO)\ndjango.conf.locale.LANG_INFO = LANG_INFO\n\nLANGUAGES = [\n    ('ar', _('Arabic')),\n    ('bn', _('Bengali')),\n    ('en', _('English')),\n    ('es', _('Spanish')),\n    ('fr', _('French')),\n    ('id', _('Indonesian')),\n    ('ja', _('Japanese')),\n    ('ms', _('Malay')),\n    ('pt', _('Portuguese')),\n    ('ru', _('Russian')),\n    ('zh-hans', _('Simplified Chinese')),\n    ('tzl', _('Translation')),\n]\n\nSTATICI18N_ROOT = os.path.join(BASE_DIR, \"locale\")\n\nFORMAT_MODULE_PATH = [\n    'utils.formats',\n]\n\n# ==============================================================================\n# Django-specific Modules\n# ==============================================================================\n\nMIDDLEWARE = [\n    'django.middleware.gzip.GZipMiddleware',\n    'django.middleware.security.SecurityMiddleware',\n    'django.contrib.sessions.middleware.SessionMiddleware',\n    # User language preferences; must be after Session\n    'django.middleware.locale.LocaleMiddleware',\n    # Set Etags; i.e. cached requests not on network; must precede Common\n    'corsheaders.middleware.CorsMiddleware',\n    'django.middleware.http.ConditionalGetMiddleware',\n    'django.middleware.common.CommonMiddleware',\n    # Must be after SessionMiddleware\n    'django.contrib.auth.middleware.AuthenticationMiddleware',\n    'django.contrib.messages.middleware.MessageMiddleware',\n    'django.middleware.clickjacking.XFrameOptionsMiddleware',\n    'utils.middleware.DebateMiddleware',\n]\n\nTABBYCAT_APPS = (\n    'actionlog',\n    'adjallocation',\n    'adjfeedback',\n    'api',\n    'availability',\n    'breakqual',\n    'checkins',\n    'divisions', # obsolete\n    'draw',\n    'motions',\n    'options',\n    'participants',\n    'printing',\n    'privateurls',\n    'results',\n    'tournaments',\n    'venues',\n    'utils',\n    'users',\n    'standings',\n    'notifications',\n    'importer',\n)\n\nINSTALLED_APPS = (\n    'jet',\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    'django.contrib.sessions',\n    'channels', # For Websockets / real-time connections (above whitenoise)\n    'django.contrib.staticfiles',\n    'django.contrib.humanize',\n    'django_summernote',  # Keep above our apps; as we unregister an admin model\n    'django.contrib.messages') \\\n    + TABBYCAT_APPS + (\n    'dynamic_preferences',\n    'django_extensions',  # For Secret Generation Command\n    'gfklookupwidget',\n    'formtools',\n    'statici18n', # Compile js translations as static file; saving requests\n    'polymorphic',\n    'corsheaders',\n    'rest_framework',\n    'rest_framework.authtoken',\n    'django_better_admin_arrayfield',\n)\n\nROOT_URLCONF = 'urls'\nLOGIN_REDIRECT_URL = '/'\nLOGOUT_REDIRECT_URL = '/'\nFIXTURE_DIRS = (os.path.join(os.path.dirname(BASE_DIR), 'data', 'fixtures'), )\nSILENCED_SYSTEM_CHECKS = ('urls.W002',)\n\n# ==============================================================================\n# Templates\n# ==============================================================================\n\nTEMPLATES = [\n    {\n        'BACKEND': 'django.template.backends.django.DjangoTemplates',\n        'DIRS': [os.path.join(BASE_DIR, 'templates')],\n        'OPTIONS': {\n            'context_processors': [\n                'django.contrib.auth.context_processors.auth',\n                'django.contrib.messages.context_processors.messages',\n                'django.template.context_processors.debug',\n                'django.template.context_processors.i18n',\n                'django.template.context_processors.media',\n                'django.template.context_processors.static',\n                'django.template.context_processors.tz',\n                'django.template.context_processors.request',  # for Jet\n                'utils.context_processors.debate_context',  # for tournament config vars\n                'django.template.context_processors.i18n',  # for serving static language translations\n                'dynamic_preferences.processors.global_preferences',\n            ],\n            'loaders': [\n                ('django.template.loaders.cached.Loader', [\n                    'django.template.loaders.filesystem.Loader',\n                    'django.template.loaders.app_directories.Loader',\n                ]),\n            ],\n        }\n    },\n]\n\n# ==============================================================================\n# Caching\n# ==============================================================================\n\nPUBLIC_FAST_CACHE_TIMEOUT = int(os.environ.get('PUBLIC_FAST_CACHE_TIMEOUT', 60 * 1))\nPUBLIC_SLOW_CACHE_TIMEOUT = int(os.environ.get('PUBLIC_SLOW_CACHE_TIMEOUT', 60 * 3.5))\nTAB_PAGES_CACHE_TIMEOUT = int(os.environ.get('TAB_PAGES_CACHE_TIMEOUT', 60 * 120))\n\n# Default non-heroku cache is to use local memory\nCACHES = {\n    'default': {\n        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',\n    },\n}\n\nSESSION_ENGINE = 'django.contrib.sessions.backends.cache'\n\n# ==============================================================================\n# Static Files and Compilation\n# ==============================================================================\n\nSTATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')\nSTATIC_URL = '/static/'\n\nSTATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'), )\n\nSTATICFILES_FINDERS = (\n    'django.contrib.staticfiles.finders.FileSystemFinder',\n    'django.contrib.staticfiles.finders.AppDirectoriesFinder',\n)\n\nSTATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'\n\n# ==============================================================================\n# Logging\n# ==============================================================================\n\nMESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'\n\nLOGGING = {\n    'version': 1,\n    'disable_existing_loggers': False,\n    'handlers': {\n        'console': {\n            'class': 'logging.StreamHandler',\n            'formatter': 'standard',\n        },\n    },\n    'loggers': {\n        'django': {\n            'handlers': ['console'],\n            'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),\n        },\n        'sentry.errors': {\n            'level': 'INFO',\n            'handlers': ['console'],\n            'propagate': False,\n        },\n    },\n    'formatters': {\n        'standard': {\n            'format': '[%(asctime)s] %(levelname)s %(name)s: %(message)s',\n        },\n    },\n}\n\nfor app in TABBYCAT_APPS:\n    LOGGING['loggers'][app] = {\n        'handlers': ['console'],\n        'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),\n    }\n\n# ==============================================================================\n# Messages\n# ==============================================================================\n\nMESSAGE_TAGS = {messages.ERROR: 'danger', }\n\n# ==============================================================================\n# Summernote (WYSWIG)\n# ==============================================================================\n\nSUMMERNOTE_THEME = 'bs4' # Bootstrap 4\n\nSUMMERNOTE_CONFIG = {\n    'width': '100%',\n    'height': '480',\n    'toolbar': [\n        ['style', ['bold', 'italic', 'underline', 'fontsize', 'color', 'clear']],\n        ['para', ['ul', 'ol']],\n        ['insert', ['link', 'picture']],\n        ['misc', ['undo', 'redo', 'codeview']],\n    ],\n    'disable_upload': True,\n    'iframe': True, # Necessary; if just to compartmentalise jQuery dependency,\n}\n\nX_FRAME_OPTIONS = 'SAMEORIGIN' # Necessary to get Django-Summernote working because of Django 3 changes\n\n# ==============================================================================\n# Database\n# ==============================================================================\n\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.postgresql',\n    },\n}\n\n# ==============================================================================\n# Channels\n# ==============================================================================\n\nASGI_APPLICATION = \"routing.application\"\n\nCHANNEL_LAYERS = {\n    \"default\": {\n        \"BACKEND\": \"channels.layers.InMemoryChannelLayer\",\n    },\n}\n\n# ==============================================================================\n# Dynamic preferences\n# ==============================================================================\n\nDYNAMIC_PREFERENCES = {\n    'REGISTRY_MODULE': 'preferences',\n}\n\n# ==============================================================================\n# REST Framework\n# ==============================================================================\n\nREST_FRAMEWORK = {\n    'DEFAULT_RENDERER_CLASSES': [\n        'rest_framework.renderers.JSONRenderer',\n    ],\n    'DEFAULT_PARSER_CLASSES': [\n        'rest_framework.parsers.JSONParser',\n    ],\n    'DEFAULT_AUTHENTICATION_CLASSES': [\n        'rest_framework.authentication.TokenAuthentication',\n    ],\n    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',\n}\n\n# ----------------------------------------\n# CORS-related settings for REST framework\n# ----------------------------------------\n\nCORS_ALLOW_ALL_ORIGINS = True\nCORS_URLS_REGEX = r'^/api(/.*)?$'\n", "path": "tabbycat/settings/core.py"}], "after_files": [{"content": "import os\n\nfrom django.contrib.messages import constants as messages\nfrom django.utils.translation import gettext_lazy as _\n\n\nBASE_DIR = os.path.dirname(os.path.abspath(os.path.join(__file__, os.pardir)))\nMEDIA_ROOT = os.path.join(BASE_DIR, 'media')\n\n# ==============================================================================\n# Overwritten in local.py or heroku.py\n# ==============================================================================\n\nADMINS = ('Philip and Chuan-Zheng', 'tabbycat@philipbelesky.com'),\nMANAGERS = ADMINS\nDEBUG = bool(int(os.environ['DEBUG'])) if 'DEBUG' in os.environ else False\nENABLE_DEBUG_TOOLBAR = False # Must default to false; overriden in Dev config\nDISABLE_SENTRY = True # Overriden in Heroku config\nSECRET_KEY = r'#2q43u&tp4((4&m3i8v%w-6z6pp7m(v0-6@w@i!j5n)n15epwc'\n\n# ==============================================================================\n# Version\n# ==============================================================================\n\nTABBYCAT_VERSION = '2.6.0-dev'\nTABBYCAT_CODENAME = 'Ocicat'\nREADTHEDOCS_VERSION = 'v2.6.0-dev'\n\n# ==============================================================================\n# Internationalization and Localization\n# ==============================================================================\n\nUSE_I18N = True\nUSE_TZ = True\nUSE_L10N = True\nLANGUAGE_CODE = 'en'\nTIME_ZONE = os.environ.get('TIME_ZONE', 'Australia/Melbourne')\n\nLOCALE_PATHS = [\n    os.path.join(BASE_DIR, 'locale'),\n]\n\n# Languages that should be available in the switcher\nEXTRA_LANG_INFO = {\n    'ms': {\n        'bidi': False,\n        'code': 'ms',\n        'name': 'Malay',\n        'name_local': 'Bahasa Melayu', #unicode codepoints here\n    },\n    'tzl': {\n        # Use code for Talossan; can't use proper reserved code...\n        # Talossan is a constructed language, without native speakers,\n        # so the odds of having a translation are low.\n        'code': 'tzl',\n        'name': 'Translation',\n        'name_local': 'Translation',\n    },\n}\n\n# Add custom languages not provided by Django\nimport django.conf.locale\nLANG_INFO = dict(django.conf.locale.LANG_INFO, **EXTRA_LANG_INFO)\ndjango.conf.locale.LANG_INFO = LANG_INFO\n\nLANGUAGES = [\n    ('ar', _('Arabic')),\n    ('bn', _('Bengali')),\n    ('en', _('English')),\n    ('es', _('Spanish')),\n    ('fr', _('French')),\n    ('id', _('Indonesian')),\n    ('ja', _('Japanese')),\n    ('ms', _('Malay')),\n    ('pt', _('Portuguese')),\n    ('ru', _('Russian')),\n    ('zh-hans', _('Simplified Chinese')),\n    ('tzl', _('Translation')),\n]\n\nSTATICI18N_ROOT = os.path.join(BASE_DIR, \"locale\")\n\nFORMAT_MODULE_PATH = [\n    'utils.formats',\n]\n\n# ==============================================================================\n# Django-specific Modules\n# ==============================================================================\n\nMIDDLEWARE = [\n    'django.middleware.gzip.GZipMiddleware',\n    'django.middleware.security.SecurityMiddleware',\n    'django.contrib.sessions.middleware.SessionMiddleware',\n    # User language preferences; must be after Session\n    'django.middleware.locale.LocaleMiddleware',\n    # Set Etags; i.e. cached requests not on network; must precede Common\n    'corsheaders.middleware.CorsMiddleware',\n    'django.middleware.http.ConditionalGetMiddleware',\n    'django.middleware.common.CommonMiddleware',\n    # Must be after SessionMiddleware\n    'django.contrib.auth.middleware.AuthenticationMiddleware',\n    'django.contrib.messages.middleware.MessageMiddleware',\n    'django.middleware.clickjacking.XFrameOptionsMiddleware',\n    'utils.middleware.DebateMiddleware',\n]\n\nTABBYCAT_APPS = (\n    'actionlog',\n    'adjallocation',\n    'adjfeedback',\n    'api',\n    'availability',\n    'breakqual',\n    'checkins',\n    'divisions', # obsolete\n    'draw',\n    'motions',\n    'options',\n    'participants',\n    'printing',\n    'privateurls',\n    'results',\n    'tournaments',\n    'venues',\n    'utils',\n    'users',\n    'standings',\n    'notifications',\n    'importer',\n)\n\nINSTALLED_APPS = (\n    'jet',\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    'django.contrib.sessions',\n    'channels', # For Websockets / real-time connections (above whitenoise)\n    'django.contrib.staticfiles',\n    'django.contrib.humanize',\n    'django_summernote',  # Keep above our apps; as we unregister an admin model\n    'django.contrib.messages') \\\n    + TABBYCAT_APPS + (\n    'dynamic_preferences',\n    'django_extensions',  # For Secret Generation Command\n    'gfklookupwidget',\n    'formtools',\n    'statici18n', # Compile js translations as static file; saving requests\n    'polymorphic',\n    'corsheaders',\n    'rest_framework',\n    'rest_framework.authtoken',\n    'django_better_admin_arrayfield',\n)\n\nROOT_URLCONF = 'urls'\nLOGIN_REDIRECT_URL = '/'\nLOGOUT_REDIRECT_URL = '/'\nFIXTURE_DIRS = (os.path.join(os.path.dirname(BASE_DIR), 'data', 'fixtures'), )\nSILENCED_SYSTEM_CHECKS = ('urls.W002',)\n\n# ==============================================================================\n# Templates\n# ==============================================================================\n\nTEMPLATES = [\n    {\n        'BACKEND': 'django.template.backends.django.DjangoTemplates',\n        'DIRS': [os.path.join(BASE_DIR, 'templates')],\n        'OPTIONS': {\n            'context_processors': [\n                'django.contrib.auth.context_processors.auth',\n                'django.contrib.messages.context_processors.messages',\n                'django.template.context_processors.debug',\n                'django.template.context_processors.i18n',\n                'django.template.context_processors.media',\n                'django.template.context_processors.static',\n                'django.template.context_processors.tz',\n                'django.template.context_processors.request',  # for Jet\n                'utils.context_processors.debate_context',  # for tournament config vars\n                'django.template.context_processors.i18n',  # for serving static language translations\n                'dynamic_preferences.processors.global_preferences',\n            ],\n            'loaders': [\n                ('django.template.loaders.cached.Loader', [\n                    'django.template.loaders.filesystem.Loader',\n                    'django.template.loaders.app_directories.Loader',\n                ]),\n            ],\n        }\n    },\n]\n\n# ==============================================================================\n# Caching\n# ==============================================================================\n\nPUBLIC_FAST_CACHE_TIMEOUT = int(os.environ.get('PUBLIC_FAST_CACHE_TIMEOUT', 60 * 1))\nPUBLIC_SLOW_CACHE_TIMEOUT = int(os.environ.get('PUBLIC_SLOW_CACHE_TIMEOUT', 60 * 3.5))\nTAB_PAGES_CACHE_TIMEOUT = int(os.environ.get('TAB_PAGES_CACHE_TIMEOUT', 60 * 120))\n\n# Default non-heroku cache is to use local memory\nCACHES = {\n    'default': {\n        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',\n    },\n}\n\nSESSION_ENGINE = 'django.contrib.sessions.backends.cache'\n\n# ==============================================================================\n# Static Files and Compilation\n# ==============================================================================\n\nSTATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')\nSTATIC_URL = '/static/'\n\nSTATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'), )\n\nSTATICFILES_FINDERS = (\n    'django.contrib.staticfiles.finders.FileSystemFinder',\n    'django.contrib.staticfiles.finders.AppDirectoriesFinder',\n)\n\nSTATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'\n\n# ==============================================================================\n# Logging\n# ==============================================================================\n\nMESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'\n\nLOGGING = {\n    'version': 1,\n    'disable_existing_loggers': False,\n    'handlers': {\n        'console': {\n            'class': 'logging.StreamHandler',\n            'formatter': 'standard',\n        },\n    },\n    'loggers': {\n        'django': {\n            'handlers': ['console'],\n            'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),\n        },\n        'sentry.errors': {\n            'level': 'INFO',\n            'handlers': ['console'],\n            'propagate': False,\n        },\n    },\n    'formatters': {\n        'standard': {\n            'format': '[%(asctime)s] %(levelname)s %(name)s: %(message)s',\n        },\n    },\n}\n\nfor app in TABBYCAT_APPS:\n    LOGGING['loggers'][app] = {\n        'handlers': ['console'],\n        'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),\n    }\n\n# ==============================================================================\n# Messages\n# ==============================================================================\n\nMESSAGE_TAGS = {messages.ERROR: 'danger', }\n\n# ==============================================================================\n# Summernote (WYSWIG)\n# ==============================================================================\n\nSUMMERNOTE_THEME = 'bs4' # Bootstrap 4\n\nSUMMERNOTE_CONFIG = {\n    'width': '100%',\n    'height': '480',\n    'toolbar': [\n        ['style', ['bold', 'italic', 'underline', 'fontsize', 'color', 'clear']],\n        ['para', ['ul', 'ol']],\n        ['insert', ['link', 'picture']],\n        ['misc', ['undo', 'redo', 'codeview']],\n    ],\n    'disable_upload': True,\n    'iframe': True, # Necessary; if just to compartmentalise jQuery dependency,\n}\n\nX_FRAME_OPTIONS = 'SAMEORIGIN' # Necessary to get Django-Summernote working because of Django 3 changes\n\n# ==============================================================================\n# Database\n# ==============================================================================\n\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.postgresql',\n    },\n}\n\nDEFAULT_AUTO_FIELD = 'django.db.models.AutoField'\n\n# ==============================================================================\n# Channels\n# ==============================================================================\n\nASGI_APPLICATION = \"routing.application\"\n\nCHANNEL_LAYERS = {\n    \"default\": {\n        \"BACKEND\": \"channels.layers.InMemoryChannelLayer\",\n    },\n}\n\n# ==============================================================================\n# Dynamic preferences\n# ==============================================================================\n\nDYNAMIC_PREFERENCES = {\n    'REGISTRY_MODULE': 'preferences',\n}\n\n# ==============================================================================\n# REST Framework\n# ==============================================================================\n\nREST_FRAMEWORK = {\n    'DEFAULT_RENDERER_CLASSES': [\n        'rest_framework.renderers.JSONRenderer',\n    ],\n    'DEFAULT_PARSER_CLASSES': [\n        'rest_framework.parsers.JSONParser',\n    ],\n    'DEFAULT_AUTHENTICATION_CLASSES': [\n        'rest_framework.authentication.TokenAuthentication',\n    ],\n    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',\n}\n\n# ----------------------------------------\n# CORS-related settings for REST framework\n# ----------------------------------------\n\nCORS_ALLOW_ALL_ORIGINS = True\nCORS_URLS_REGEX = r'^/api(/.*)?$'\n", "path": "tabbycat/settings/core.py"}]}