Browse Source

#590: replaced django.conf with misago.conf in modules that rely on MISAGO_ settings

Rafał Pitoń 8 years ago
parent
commit
84a1312add
43 changed files with 158 additions and 251 deletions
  1. 1 1
      misago/acl/providers.py
  2. 2 1
      misago/acl/tests/test_providers.py
  3. 2 1
      misago/admin/admin.py
  4. 2 1
      misago/admin/auth.py
  5. 2 1
      misago/admin/middleware.py
  6. 2 1
      misago/admin/views/__init__.py
  7. 2 1
      misago/categories/urls/__init__.py
  8. 14 16
      misago/conf/context_processors.py
  9. 64 189
      misago/conf/defaults.py
  10. 9 1
      misago/conf/gateway.py
  11. 4 1
      misago/conf/tests/test_settings.py
  12. 3 1
      misago/core/middleware/exceptionhandler.py
  13. 4 1
      misago/core/middleware/frontendcontext.py
  14. 3 1
      misago/core/middleware/threadstore.py
  15. 2 1
      misago/markup/pipeline.py
  16. 2 1
      misago/readtracker/dates.py
  17. 1 1
      misago/threads/api/postendpoints/merge.py
  18. 2 1
      misago/threads/api/postendpoints/move.py
  19. 2 1
      misago/threads/api/postendpoints/split.py
  20. 1 1
      misago/threads/api/postingendpoint/attachments.py
  21. 2 1
      misago/threads/api/postingendpoint/floodprotection.py
  22. 1 1
      misago/threads/management/commands/clearattachments.py
  23. 3 1
      misago/threads/middleware.py
  24. 1 1
      misago/threads/models/attachment.py
  25. 1 1
      misago/threads/tests/test_attachments_api.py
  26. 1 2
      misago/threads/tests/test_attachments_middleware.py
  27. 1 1
      misago/threads/tests/test_attachmentview.py
  28. 1 1
      misago/threads/tests/test_clearattachments.py
  29. 1 1
      misago/threads/tests/test_threadslists.py
  30. 1 1
      misago/threads/threadtypes/treesmap.py
  31. 2 1
      misago/threads/urls/__init__.py
  32. 1 2
      misago/threads/viewmodels/posts.py
  33. 1 1
      misago/threads/viewmodels/threads.py
  34. 2 1
      misago/threads/views/attachment.py
  35. 1 1
      misago/urls.py
  36. 1 1
      misago/users/activepostersranking.py
  37. 2 1
      misago/users/avatars/gallery.py
  38. 4 3
      misago/users/middleware.py
  39. 2 1
      misago/users/tests/test_avatarserver_views.py
  40. 1 2
      misago/users/viewmodels/threads.py
  41. 2 1
      misago/users/views/avatarserver.py
  42. 1 1
      misago/users/views/lists.py
  43. 1 1
      misago/users/views/profile.py

+ 1 - 1
misago/acl/providers.py

@@ -1,6 +1,6 @@
 from importlib import import_module
 from importlib import import_module
 
 
-from django.conf import settings
+from misago.conf import settings
 
 
 
 
 __ALL__ = ['providers']
 __ALL__ = ['providers']

+ 2 - 1
misago/acl/tests/test_providers.py

@@ -1,10 +1,11 @@
 # pylint: disable=protected-access
 # pylint: disable=protected-access
 from types import ModuleType
 from types import ModuleType
 
 
-from django.conf import settings
 from django.test import TestCase
 from django.test import TestCase
 from django.utils import six
 from django.utils import six
 
 
+from misago.conf import settings
+
 from ..providers import PermissionProviders
 from ..providers import PermissionProviders
 
 
 
 

+ 2 - 1
misago/admin/admin.py

@@ -1,8 +1,9 @@
 from django.conf.urls import url
 from django.conf.urls import url
+from django.utils.deprecation import MiddlewareMixin
 from django.utils.translation import ugettext_lazy as _
 from django.utils.translation import ugettext_lazy as _
 
 
 
 
-class MisagoAdminExtension(object):
+class MisagoAdminExtension(MiddlewareMixin):
     def register_urlpatterns(self, urlpatterns):
     def register_urlpatterns(self, urlpatterns):
         pass
         pass
 
 

+ 2 - 1
misago/admin/auth.py

@@ -1,11 +1,12 @@
 from hashlib import md5
 from hashlib import md5
 from time import time
 from time import time
 
 
-from django.conf import settings
 from django.contrib import auth as dj_auth
 from django.contrib import auth as dj_auth
 from django.contrib import messages
 from django.contrib import messages
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 
 
+from misago.conf import settings
+
 
 
 KEY_TOKEN = 'misago_admin_session_token'
 KEY_TOKEN = 'misago_admin_session_token'
 KEY_UPDATED = 'misago_admin_session_updated'
 KEY_UPDATED = 'misago_admin_session_updated'

+ 2 - 1
misago/admin/middleware.py

@@ -1,11 +1,12 @@
 from django.shortcuts import redirect
 from django.shortcuts import redirect
+from django.utils.deprecation import MiddlewareMixin
 
 
 from . import auth
 from . import auth
 from .views import get_protected_namespace
 from .views import get_protected_namespace
 from .views.auth import login
 from .views.auth import login
 
 
 
 
-class AdminAuthMiddleware(object):
+class AdminAuthMiddleware(MiddlewareMixin):
     def process_view(self, request, view_func, view_args, view_kwargs):
     def process_view(self, request, view_func, view_args, view_kwargs):
         request.admin_namespace = get_protected_namespace(request)
         request.admin_namespace = get_protected_namespace(request)
 
 

+ 2 - 1
misago/admin/views/__init__.py

@@ -1,7 +1,8 @@
-from django.conf import settings
 from django.urls import reverse, NoReverseMatch
 from django.urls import reverse, NoReverseMatch
 from django.shortcuts import render as dj_render
 from django.shortcuts import render as dj_render
 
 
+from misago.conf import settings
+
 from .. import site
 from .. import site
 from ..auth import is_admin_session, update_admin_session
 from ..auth import is_admin_session, update_admin_session
 from .auth import login
 from .auth import login

+ 2 - 1
misago/categories/urls/__init__.py

@@ -1,7 +1,8 @@
-from django.conf import settings
 from django.conf.urls import url
 from django.conf.urls import url
 
 
+from misago.conf import settings
 from misago.core.views import home_redirect
 from misago.core.views import home_redirect
+
 from ..views.categorieslist import categories
 from ..views.categorieslist import categories
 
 
 
 

+ 14 - 16
misago/conf/context_processors.py

@@ -3,26 +3,24 @@ import json
 from django.contrib.staticfiles.templatetags.staticfiles import static
 from django.contrib.staticfiles.templatetags.staticfiles import static
 from django.urls import reverse
 from django.urls import reverse
 
 
-from misago.conf import settings
+from .gateway import db_settings, settings as misago_settings  # noqa
 
 
-from .gateway import db_settings, dj_settings  # noqa
 
 
-
-BLANK_AVATAR_URL = static(settings.MISAGO_BLANK_AVATAR)
+BLANK_AVATAR_URL = static(misago_settings.MISAGO_BLANK_AVATAR)
 
 
 
 
 def settings(request):
 def settings(request):
     return {
     return {
-        'DEBUG': dj_settings.DEBUG,
+        'DEBUG': misago_settings.DEBUG,
         'misago_settings': db_settings,
         'misago_settings': db_settings,
 
 
         'BLANK_AVATAR_URL': BLANK_AVATAR_URL,
         'BLANK_AVATAR_URL': BLANK_AVATAR_URL,
 
 
-        'THREADS_ON_INDEX': dj_settings.MISAGO_THREADS_ON_INDEX,
+        'THREADS_ON_INDEX': misago_settings.MISAGO_THREADS_ON_INDEX,
 
 
-        'LOGIN_REDIRECT_URL': dj_settings.LOGIN_REDIRECT_URL,
-        'LOGIN_URL': dj_settings.LOGIN_URL,
-        'LOGOUT_URL': dj_settings.LOGOUT_URL,
+        'LOGIN_REDIRECT_URL': misago_settings.LOGIN_REDIRECT_URL,
+        'LOGIN_URL': misago_settings.LOGIN_URL,
+        'LOGOUT_URL': misago_settings.LOGOUT_URL,
     }
     }
 
 
 
 
@@ -30,12 +28,12 @@ def preload_settings_json(request):
     preloaded_settings = db_settings.get_public_settings()
     preloaded_settings = db_settings.get_public_settings()
 
 
     preloaded_settings.update({
     preloaded_settings.update({
-        'LOGIN_API_URL': dj_settings.MISAGO_LOGIN_API_URL,
+        'LOGIN_API_URL': misago_settings.MISAGO_LOGIN_API_URL,
 
 
-        'LOGIN_REDIRECT_URL': reverse(dj_settings.LOGIN_REDIRECT_URL),
-        'LOGIN_URL': reverse(dj_settings.LOGIN_URL),
+        'LOGIN_REDIRECT_URL': reverse(misago_settings.LOGIN_REDIRECT_URL),
+        'LOGIN_URL': reverse(misago_settings.LOGIN_URL),
 
 
-        'LOGOUT_URL': reverse(dj_settings.LOGOUT_URL),
+        'LOGOUT_URL': reverse(misago_settings.LOGOUT_URL),
     })
     })
 
 
     request.frontend_context.update({
     request.frontend_context.update({
@@ -44,11 +42,11 @@ def preload_settings_json(request):
         'MISAGO_PATH': reverse('misago:index'),
         'MISAGO_PATH': reverse('misago:index'),
 
 
         'BLANK_AVATAR_URL': BLANK_AVATAR_URL,
         'BLANK_AVATAR_URL': BLANK_AVATAR_URL,
-        'STATIC_URL': dj_settings.STATIC_URL,
+        'STATIC_URL': misago_settings.STATIC_URL,
 
 
-        'CSRF_COOKIE_NAME': dj_settings.CSRF_COOKIE_NAME,
+        'CSRF_COOKIE_NAME': misago_settings.CSRF_COOKIE_NAME,
 
 
-        'THREADS_ON_INDEX': dj_settings.MISAGO_THREADS_ON_INDEX,
+        'THREADS_ON_INDEX': misago_settings.MISAGO_THREADS_ON_INDEX,
     })
     })
 
 
     return {}
     return {}

+ 64 - 189
misago/conf/defaults.py

@@ -1,126 +1,19 @@
 """
 """
-Misago default settings
+Default Misago settings. Override these with settings in the module pointed to
+by the DJANGO_SETTINGS_MODULE environment variable.
 
 
-This fille sets everything Misago needs to run.
-
-If you want to add custom app, middleware or path, please update setting vallue
-defined in this file instead of copying setting from here to your settings.py.
-
-Yes:
-
-#yourproject/settings.py
-INSTALLED_APPS += (
-    'myawesomeapp',
-)
-
-No:
-
-#yourproject/settings.py
-INSTALLED_APPS = (
-    'django.contrib.admin',
-    'django.contrib.auth',
-    'misago.core',
-    'misago.conf',
-    ...
-    'myawesomeapp',
-)
+If you rely on any of those in your code, make sure you use `misago.conf.settings`
+instead of Django's `django.conf.settings`.
 """
 """
 
 
 # Default JS debug to false
 # Default JS debug to false
 # This setting used exclusively by test runner and isn't part of public API
 # This setting used exclusively by test runner and isn't part of public API
-_MISAGO_JS_DEBUG = False
-
 
 
-# Application definition
-
-INSTALLED_APPS = (
-    # Load Misago's locale/templates/static files
-    'misago',
-
-    # Keep misago.users above django.contrib.auth
-    # so our management commands take precedence over theirs
-    'misago.users',
-
-    # Django and 3rd party apps
-    'django.contrib.admin',
-    'django.contrib.auth',
-    'django.contrib.contenttypes',
-    'django.contrib.sessions',
-    'django.contrib.messages',
-    'django.contrib.staticfiles',
-    'django.contrib.humanize',
-    'debug_toolbar',
-    'crispy_forms',
-    'mptt',
-    'rest_framework',
-
-    # Misago apps
-    'misago.admin',
-    'misago.acl',
-    'misago.core',
-    'misago.conf',
-    'misago.markup',
-    'misago.legal',
-    'misago.categories',
-    'misago.threads',
-    'misago.readtracker',
-    'misago.search',
-    'misago.faker',
-
-    # Utility for moving data from Misago 0.5
-    'misago.datamover',
-)
-
-MIDDLEWARE_CLASSES = (
-    'debug_toolbar.middleware.DebugToolbarMiddleware',
-
-    'misago.users.middleware.RealIPMiddleware',
-    'misago.core.middleware.frontendcontext.FrontendContextMiddleware',
-
-    'django.contrib.sessions.middleware.SessionMiddleware',
-    'django.middleware.common.CommonMiddleware',
-    'django.middleware.csrf.CsrfViewMiddleware',
-    'django.contrib.auth.middleware.AuthenticationMiddleware',
-    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
-
-    'misago.users.middleware.UserMiddleware',
-
-    'django.contrib.messages.middleware.MessageMiddleware',
-    'django.middleware.clickjacking.XFrameOptionsMiddleware',
+_MISAGO_JS_DEBUG = False
 
 
-    'misago.core.middleware.exceptionhandler.ExceptionHandlerMiddleware',
-    'misago.users.middleware.OnlineTrackerMiddleware',
-    'misago.admin.middleware.AdminAuthMiddleware',
-    'misago.threads.middleware.UnreadThreadsCountMiddleware',
-    'misago.core.middleware.threadstore.ThreadStoreMiddleware',
-)
 
 
-DEFAULT_CONTEXT_PROCESSORS = (
-    'django.template.context_processors.debug',
-    'django.template.context_processors.i18n',
-    'django.template.context_processors.media',
-    'django.template.context_processors.static',
-    'django.template.context_processors.tz',
-
-    'django.contrib.auth.context_processors.auth',
-    'django.contrib.messages.context_processors.messages',
-
-    'misago.core.context_processors.site_address',
-    'misago.conf.context_processors.settings',
-    'misago.users.context_processors.user_links',
-    'misago.legal.context_processors.legal_links',
-
-    # Data preloaders
-    'misago.conf.context_processors.preload_settings_json',
-    'misago.core.context_processors.current_link',
-    'misago.markup.context_processors.preload_api_url',
-    'misago.threads.context_processors.preload_threads_urls',
-    'misago.users.context_processors.preload_user_json',
-
-    # Note: keep frontend_context processor last for previous processors
-    # to be able to add data to request.frontend_context
-    'misago.core.context_processors.frontend_context',
-)
+# Permissions system extensions
+# https://misago.readthedocs.io/en/latest/developers/acls.html#extending-permissions-system
 
 
 MISAGO_ACL_EXTENSIONS = (
 MISAGO_ACL_EXTENSIONS = (
     'misago.users.permissions.account',
     'misago.users.permissions.account',
@@ -135,8 +28,15 @@ MISAGO_ACL_EXTENSIONS = (
     'misago.search.permissions',
     'misago.search.permissions',
 )
 )
 
 
+
+# Custom markup extensions
+
 MISAGO_MARKUP_EXTENSIONS = ()
 MISAGO_MARKUP_EXTENSIONS = ()
 
 
+
+# Posting middlewares
+# https://misago.readthedocs.io/en/latest/developers/posting_process.html
+
 MISAGO_POSTING_MIDDLEWARES = (
 MISAGO_POSTING_MIDDLEWARES = (
     # Always keep FloodProtectionMiddleware middleware first one
     # Always keep FloodProtectionMiddleware middleware first one
     'misago.threads.api.postingendpoint.floodprotection.FloodProtectionMiddleware',
     'misago.threads.api.postingendpoint.floodprotection.FloodProtectionMiddleware',
@@ -163,50 +63,40 @@ MISAGO_POSTING_MIDDLEWARES = (
     'misago.threads.api.postingendpoint.emailnotification.EmailNotificationMiddleware',
     'misago.threads.api.postingendpoint.emailnotification.EmailNotificationMiddleware',
 )
 )
 
 
+
+# Configured thread types
+
 MISAGO_THREAD_TYPES = (
 MISAGO_THREAD_TYPES = (
     'misago.threads.threadtypes.thread.Thread',
     'misago.threads.threadtypes.thread.Thread',
     'misago.threads.threadtypes.privatethread.PrivateThread',
     'misago.threads.threadtypes.privatethread.PrivateThread',
 )
 )
 
 
+
+# Search extensions
+
 MISAGO_SEARCH_EXTENSIONS = (
 MISAGO_SEARCH_EXTENSIONS = (
     'misago.threads.search.SearchThreads',
     'misago.threads.search.SearchThreads',
     'misago.users.search.SearchUsers',
     'misago.users.search.SearchUsers',
 )
 )
 
 
 
 
-# Internationalization
-
-USE_I18N = True
+# Misago-admin specific date formats
 
 
-USE_L10N = True
-
-USE_TZ = True
-
-TIME_ZONE = 'UTC'
-
-
-# Misago specific date formats
-# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
 MISAGO_COMPACT_DATE_FORMAT_DAY_MONTH = 'j M'
 MISAGO_COMPACT_DATE_FORMAT_DAY_MONTH = 'j M'
 MISAGO_COMPACT_DATE_FORMAT_DAY_MONTH_YEAR = 'M \'y'
 MISAGO_COMPACT_DATE_FORMAT_DAY_MONTH_YEAR = 'M \'y'
 
 
 
 
-# Use Misago CSRF Failure Page
-CSRF_FAILURE_VIEW = 'misago.core.errorpages.csrf_failure'
-
-
-# Use Misago authentication
-AUTH_USER_MODEL = 'misago_users.User'
-
-AUTHENTICATION_BACKENDS = (
-    'misago.users.authbackends.MisagoBackend',
-)
+# Additional registration validators
+# https://misago.readthedocs.io/en/latest/developers/validating_registrations.html
 
 
 MISAGO_NEW_REGISTRATIONS_VALIDATORS = (
 MISAGO_NEW_REGISTRATIONS_VALIDATORS = (
     'misago.users.validators.validate_gmail_email',
     'misago.users.validators.validate_gmail_email',
     'misago.users.validators.validate_with_sfs',
     'misago.users.validators.validate_with_sfs',
 )
 )
 
 
+
+# Stop Forum Spam settings
+
 MISAGO_USE_STOP_FORUM_SPAM = True
 MISAGO_USE_STOP_FORUM_SPAM = True
 MISAGO_STOP_FORUM_SPAM_MIN_CONFIDENCE = 80
 MISAGO_STOP_FORUM_SPAM_MIN_CONFIDENCE = 80
 
 
@@ -216,95 +106,114 @@ MISAGO_STOP_FORUM_SPAM_MIN_CONFIDENCE = 80
 
 
 MISAGO_MAILER_BATCH_SIZE = 20
 MISAGO_MAILER_BATCH_SIZE = 20
 
 
-# Auth paths
+
+# Login API URL
+
 MISAGO_LOGIN_API_URL = 'auth'
 MISAGO_LOGIN_API_URL = 'auth'
 
 
-LOGIN_REDIRECT_URL = 'misago:index'
-LOGIN_URL = 'misago:login'
-LOGOUT_URL = 'misago:logout'
 
 
 # Misago Admin Path
 # Misago Admin Path
-# Omit starting and trailing slashes
-# To disable Misago admin, empty this value
+# Omit starting and trailing slashes. To disable Misago admin, empty this value.
+
 MISAGO_ADMIN_PATH = 'admincp'
 MISAGO_ADMIN_PATH = 'admincp'
 
 
+
 # Admin urls namespaces that Misago's AdminAuthMiddleware should protect
 # Admin urls namespaces that Misago's AdminAuthMiddleware should protect
+
 MISAGO_ADMIN_NAMESPACES = (
 MISAGO_ADMIN_NAMESPACES = (
     'admin',
     'admin',
     'misago:admin',
     'misago:admin',
 )
 )
 
 
-# How long (in minutes) since previous request to admin namespace should
-# admin session last.
+
+# How long (in minutes) since previous request to admin namespace should admin session last.
+
 MISAGO_ADMIN_SESSION_EXPIRATION = 60
 MISAGO_ADMIN_SESSION_EXPIRATION = 60
 
 
 
 
 # Display threads on forum index
 # Display threads on forum index
 # Change this to false to display categories list instead
 # Change this to false to display categories list instead
+
 MISAGO_THREADS_ON_INDEX = True
 MISAGO_THREADS_ON_INDEX = True
 
 
 
 
 # Max age of notifications in days
 # Max age of notifications in days
-# Notifications older than this are deleted
-# On very active forums its better to keep this smaller
+# Notifications older than this are deleted. On very active forums its better to keep this smaller.
+
 MISAGO_NOTIFICATIONS_MAX_AGE = 40
 MISAGO_NOTIFICATIONS_MAX_AGE = 40
 
 
 
 
 # Fail-safe limits in case forum is raided by spambot
 # Fail-safe limits in case forum is raided by spambot
-# No user may exceed those limits, however you may disable
-# them by changing them to 0
+# No user may exceed those limits, however you may disable them by changing them to 0.
+
 MISAGO_DIALY_POST_LIMIT = 600
 MISAGO_DIALY_POST_LIMIT = 600
 MISAGO_HOURLY_POST_LIMIT = 100
 MISAGO_HOURLY_POST_LIMIT = 100
 
 
 
 
 # Function used for generating individual avatar for user
 # Function used for generating individual avatar for user
+
 MISAGO_DYNAMIC_AVATAR_DRAWER = 'misago.users.avatars.dynamic.draw_default'
 MISAGO_DYNAMIC_AVATAR_DRAWER = 'misago.users.avatars.dynamic.draw_default'
 
 
 
 
 # Path to directory containing avatar galleries
 # Path to directory containing avatar galleries
 # Those galleries can be loaded by running loadavatargallery command
 # Those galleries can be loaded by running loadavatargallery command
+
 MISAGO_AVATAR_GALLERY = None
 MISAGO_AVATAR_GALLERY = None
 
 
+
 # Save user avatars for sizes
 # Save user avatars for sizes
 # Keep sizes ordered from greatest to smallest
 # Keep sizes ordered from greatest to smallest
 # Max size also controls min size of uploaded image as well as crop size
 # Max size also controls min size of uploaded image as well as crop size
+
 MISAGO_AVATARS_SIZES = (400, 200, 150, 100, 64, 50, 30)
 MISAGO_AVATARS_SIZES = (400, 200, 150, 100, 64, 50, 30)
 
 
-# Path to blank avatar
+
+# Path to blank avatar image used for guests and removed users.
+
 MISAGO_BLANK_AVATAR = 'blank-avatar.png'
 MISAGO_BLANK_AVATAR = 'blank-avatar.png'
 
 
 
 
-# Number of threads displayed on single page
+# Threads lists pagination settings
+
 MISAGO_THREADS_PER_PAGE = 25
 MISAGO_THREADS_PER_PAGE = 25
 MISAGO_THREADS_TAIL = 15
 MISAGO_THREADS_TAIL = 15
 
 
 
 
-# Number of posts displayed on single thread page
+# Posts lists pagination settings
+
 MISAGO_POSTS_PER_PAGE = 18
 MISAGO_POSTS_PER_PAGE = 18
 MISAGO_POSTS_TAIL = 6
 MISAGO_POSTS_TAIL = 6
 
 
 
 
 # Number of events displayed on single thread page
 # Number of events displayed on single thread page
 # If there's more events than specified, oldest events will be trimmed
 # If there's more events than specified, oldest events will be trimmed
+
 MISAGO_EVENTS_PER_PAGE = 20
 MISAGO_EVENTS_PER_PAGE = 20
 
 
 
 
 # Number of attachments possible to assign to single post
 # Number of attachments possible to assign to single post
+
 MISAGO_POST_ATTACHMENTS_LIMIT = 16
 MISAGO_POST_ATTACHMENTS_LIMIT = 16
 
 
+
 # Max allowed size of image before Misago will generate thumbnail for it
 # Max allowed size of image before Misago will generate thumbnail for it
+
 MISAGO_ATTACHMENT_IMAGE_SIZE_LIMIT = (500, 500)
 MISAGO_ATTACHMENT_IMAGE_SIZE_LIMIT = (500, 500)
 
 
+
 # Length of secret used for attachments url tokens and filenames
 # Length of secret used for attachments url tokens and filenames
+
 MISAGO_ATTACHMENT_SECRET_LENGTH = 64
 MISAGO_ATTACHMENT_SECRET_LENGTH = 64
 
 
 # How old (in minutes) should attachments unassociated with any be before they'll
 # How old (in minutes) should attachments unassociated with any be before they'll
 # automatically deleted by "clearattachments" task
 # automatically deleted by "clearattachments" task
+
 MISAGO_ATTACHMENT_ORPHANED_EXPIRE = 24 * 60
 MISAGO_ATTACHMENT_ORPHANED_EXPIRE = 24 * 60
 
 
 
 
 # Names of files served when user requests file that doesn't exist or is unavailable
 # Names of files served when user requests file that doesn't exist or is unavailable
 # Those files will be sought within STATIC_ROOT directory
 # Those files will be sought within STATIC_ROOT directory
+
 MISAGO_404_IMAGE = 'misago/img/error-404.png'
 MISAGO_404_IMAGE = 'misago/img/error-404.png'
 MISAGO_403_IMAGE = 'misago/img/error-403.png'
 MISAGO_403_IMAGE = 'misago/img/error-403.png'
 
 
@@ -314,13 +223,16 @@ MISAGO_403_IMAGE = 'misago/img/error-403.png'
 # If your forum runs out of memory when trying to generate users rankings list
 # If your forum runs out of memory when trying to generate users rankings list
 # or you want those to be more dynamic, give this setting lower value
 # or you want those to be more dynamic, give this setting lower value
 # You don't have to be overzelous with this as user rankings are cached for 24h
 # You don't have to be overzelous with this as user rankings are cached for 24h
+
 MISAGO_RANKING_LENGTH = 30
 MISAGO_RANKING_LENGTH = 30
 
 
 # Controls max number of items displayed on ranked lists
 # Controls max number of items displayed on ranked lists
+
 MISAGO_RANKING_SIZE = 50
 MISAGO_RANKING_SIZE = 50
 
 
 
 
 # Controls number of users displayed on single page
 # Controls number of users displayed on single page
+
 MISAGO_USERS_PER_PAGE = 12
 MISAGO_USERS_PER_PAGE = 12
 
 
 
 
@@ -328,42 +240,5 @@ MISAGO_USERS_PER_PAGE = 12
 # Items older than number of days specified below are considered read
 # Items older than number of days specified below are considered read
 # Depending on amount of new content being posted on your forum you may want
 # Depending on amount of new content being posted on your forum you may want
 # To decrease or increase this number to fine-tune readtracker performance
 # To decrease or increase this number to fine-tune readtracker performance
-MISAGO_READTRACKER_CUTOFF = 40
 
 
-
-# Default forms templates
-CRISPY_TEMPLATE_PACK = 'bootstrap3'
-
-
-# Rest Framework Configuration
-REST_FRAMEWORK = {
-    'DEFAULT_PERMISSION_CLASSES': (
-        'misago.core.rest_permissions.IsAuthenticatedOrReadOnly',
-    ),
-    'DEFAULT_RENDERER_CLASSES': (
-        'rest_framework.renderers.JSONRenderer',
-    ),
-    'EXCEPTION_HANDLER': 'misago.core.exceptionhandler.handle_api_exception',
-    'UNAUTHENTICATED_USER': 'misago.users.models.AnonymousUser',
-    'URL_FORMAT_OVERRIDE': None,
-}
-
-
-# Register Misago debug panels
-DEBUG_TOOLBAR_PANELS = (
-    'debug_toolbar.panels.versions.VersionsPanel',
-    'debug_toolbar.panels.timer.TimerPanel',
-    'debug_toolbar.panels.settings.SettingsPanel',
-    'debug_toolbar.panels.headers.HeadersPanel',
-    'debug_toolbar.panels.request.RequestPanel',
-    'debug_toolbar.panels.sql.SQLPanel',
-    'misago.acl.panels.MisagoACLPanel',
-    'debug_toolbar.panels.staticfiles.StaticFilesPanel',
-    'debug_toolbar.panels.templates.TemplatesPanel',
-    'debug_toolbar.panels.cache.CachePanel',
-    'debug_toolbar.panels.signals.SignalsPanel',
-    'debug_toolbar.panels.logging.LoggingPanel',
-)
-
-# Show debug toolbar for localhost
-INTERNAL_IPS = ['127.0.0.1']
+MISAGO_READTRACKER_CUTOFF = 40

+ 9 - 1
misago/conf/gateway.py

@@ -1,5 +1,6 @@
 from django.conf import settings as dj_settings
 from django.conf import settings as dj_settings
 
 
+from . import defaults
 from .dbsettings import db_settings
 from .dbsettings import db_settings
 
 
 
 
@@ -8,7 +9,14 @@ class SettingsGateway(object):
         try:
         try:
             return getattr(dj_settings, name)
             return getattr(dj_settings, name)
         except AttributeError:
         except AttributeError:
-            return getattr(db_settings, name)
+            pass
+
+        try:
+            return getattr(defaults, name)
+        except AttributeError:
+            pass
+
+        return getattr(db_settings, name)
 
 
 
 
 settings = SettingsGateway()
 settings = SettingsGateway()

+ 4 - 1
misago/conf/tests/test_settings.py

@@ -5,6 +5,7 @@ from django.test import TestCase
 from misago.core import threadstore
 from misago.core import threadstore
 from misago.core.cache import cache
 from misago.core.cache import cache
 
 
+from .. import defaults
 from ..dbsettings import db_settings
 from ..dbsettings import db_settings
 from ..gateway import settings as gateway
 from ..gateway import settings as gateway
 from ..migrationutils import migrate_settings_group
 from ..migrationutils import migrate_settings_group
@@ -27,8 +28,10 @@ class GatewaySettingsTests(TestCase):
     def test_get_existing_setting(self):
     def test_get_existing_setting(self):
         """forum_name is defined"""
         """forum_name is defined"""
         self.assertEqual(gateway.forum_name, db_settings.forum_name)
         self.assertEqual(gateway.forum_name, db_settings.forum_name)
+        self.assertEqual(gateway.INSTALLED_APPS,
+                         dj_settings.INSTALLED_APPS)
         self.assertEqual(gateway.MISAGO_MAILER_BATCH_SIZE,
         self.assertEqual(gateway.MISAGO_MAILER_BATCH_SIZE,
-                         dj_settings.MISAGO_MAILER_BATCH_SIZE)
+                         defaults.MISAGO_MAILER_BATCH_SIZE)
 
 
         with self.assertRaises(AttributeError):
         with self.assertRaises(AttributeError):
             gateway.LoremIpsum
             gateway.LoremIpsum

+ 3 - 1
misago/core/middleware/exceptionhandler.py

@@ -1,8 +1,10 @@
+from django.utils.deprecation import MiddlewareMixin
+
 from .. import exceptionhandler
 from .. import exceptionhandler
 from ..utils import is_request_to_misago
 from ..utils import is_request_to_misago
 
 
 
 
-class ExceptionHandlerMiddleware(object):
+class ExceptionHandlerMiddleware(MiddlewareMixin):
     def process_exception(self, request, exception):
     def process_exception(self, request, exception):
         request_is_to_misago = is_request_to_misago(request)
         request_is_to_misago = is_request_to_misago(request)
         misago_can_handle_exception = exceptionhandler.is_misago_exception(
         misago_can_handle_exception = exceptionhandler.is_misago_exception(

+ 4 - 1
misago/core/middleware/frontendcontext.py

@@ -1,4 +1,7 @@
-class FrontendContextMiddleware(object):
+from django.utils.deprecation import MiddlewareMixin
+
+
+class FrontendContextMiddleware(MiddlewareMixin):
     def process_request(self, request):
     def process_request(self, request):
         request.include_frontend_context = True
         request.include_frontend_context = True
         request.frontend_context = {}
         request.frontend_context = {}

+ 3 - 1
misago/core/middleware/threadstore.py

@@ -1,7 +1,9 @@
+from django.utils.deprecation import MiddlewareMixin
+
 from .. import threadstore
 from .. import threadstore
 
 
 
 
-class ThreadStoreMiddleware(object):
+class ThreadStoreMiddleware(MiddlewareMixin):
     def process_response(self, request, response):
     def process_response(self, request, response):
         threadstore.clear()
         threadstore.clear()
         return response
         return response

+ 2 - 1
misago/markup/pipeline.py

@@ -2,9 +2,10 @@ from importlib import import_module
 
 
 from bs4 import BeautifulSoup
 from bs4 import BeautifulSoup
 
 
-from django.conf import settings
 from django.utils import six
 from django.utils import six
 
 
+from misago.conf import settings
+
 
 
 class MarkupPipeline(object):
 class MarkupPipeline(object):
     """
     """

+ 2 - 1
misago/readtracker/dates.py

@@ -1,8 +1,9 @@
 from datetime import timedelta
 from datetime import timedelta
 
 
-from django.conf import settings
 from django.utils import timezone
 from django.utils import timezone
 
 
+from misago.conf import settings
+
 
 
 def get_cutoff_date(*dates):
 def get_cutoff_date(*dates):
     return timezone.now() - timedelta(days=settings.MISAGO_READTRACKER_CUTOFF)
     return timezone.now() - timedelta(days=settings.MISAGO_READTRACKER_CUTOFF)

+ 1 - 1
misago/threads/api/postendpoints/merge.py

@@ -1,4 +1,3 @@
-from django.conf import settings
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 from django.utils.translation import ungettext
 from django.utils.translation import ungettext
@@ -6,6 +5,7 @@ from django.utils.translation import ungettext
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
 from misago.acl import add_acl
 from misago.acl import add_acl
+from misago.conf import settings
 
 
 from ...permissions.threads import exclude_invisible_posts
 from ...permissions.threads import exclude_invisible_posts
 from ...serializers import PostSerializer
 from ...serializers import PostSerializer

+ 2 - 1
misago/threads/api/postendpoints/move.py

@@ -1,4 +1,3 @@
-from django.conf import settings
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.http import Http404
 from django.http import Http404
 from django.utils import six
 from django.utils import six
@@ -6,6 +5,8 @@ from django.utils.translation import ugettext as _, ungettext
 
 
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
+from misago.conf import settings
+
 from ...permissions.threads import allow_move_post, exclude_invisible_posts
 from ...permissions.threads import allow_move_post, exclude_invisible_posts
 from ...utils import get_thread_id_from_url
 from ...utils import get_thread_id_from_url
 
 

+ 2 - 1
misago/threads/api/postendpoints/split.py

@@ -1,4 +1,3 @@
-from django.conf import settings
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 from django.utils.translation import ungettext
 from django.utils.translation import ungettext
@@ -6,6 +5,8 @@ from django.utils.translation import ungettext
 from rest_framework import serializers
 from rest_framework import serializers
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
+from misago.conf import settings
+
 from ...events import record_event
 from ...events import record_event
 from ...models import THREAD_WEIGHT_GLOBAL, Thread
 from ...models import THREAD_WEIGHT_GLOBAL, Thread
 from ...moderation import threads as moderation
 from ...moderation import threads as moderation

+ 1 - 1
misago/threads/api/postingendpoint/attachments.py

@@ -1,10 +1,10 @@
-from django.conf import settings
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 from django.utils.translation import ungettext
 from django.utils.translation import ungettext
 
 
 from rest_framework import serializers
 from rest_framework import serializers
 
 
 from misago.acl import add_acl
 from misago.acl import add_acl
+from misago.conf import settings
 
 
 from . import PostingEndpoint, PostingInterrupt, PostingMiddleware
 from . import PostingEndpoint, PostingInterrupt, PostingMiddleware
 from ...serializers import AttachmentSerializer
 from ...serializers import AttachmentSerializer

+ 2 - 1
misago/threads/api/postingendpoint/floodprotection.py

@@ -1,9 +1,10 @@
 from datetime import timedelta
 from datetime import timedelta
 
 
-from django.conf import settings
 from django.utils import timezone
 from django.utils import timezone
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 
 
+from misago.conf import settings
+
 from . import PostingEndpoint, PostingInterrupt, PostingMiddleware
 from . import PostingEndpoint, PostingInterrupt, PostingMiddleware
 
 
 
 

+ 1 - 1
misago/threads/management/commands/clearattachments.py

@@ -1,10 +1,10 @@
 import time
 import time
 from datetime import timedelta
 from datetime import timedelta
 
 
-from django.conf import settings
 from django.core.management.base import BaseCommand
 from django.core.management.base import BaseCommand
 from django.utils import timezone
 from django.utils import timezone
 
 
+from misago.conf import settings
 from misago.core.management.progressbar import show_progress
 from misago.core.management.progressbar import show_progress
 from misago.core.pgutils import batch_update
 from misago.core.pgutils import batch_update
 
 

+ 3 - 1
misago/threads/middleware.py

@@ -1,3 +1,5 @@
+from django.utils.deprecation import MiddlewareMixin
+
 from misago.categories.models import Category
 from misago.categories.models import Category
 
 
 from .models import Thread
 from .models import Thread
@@ -5,7 +7,7 @@ from .permissions import exclude_invisible_threads
 from .viewmodels import filter_read_threads_queryset
 from .viewmodels import filter_read_threads_queryset
 
 
 
 
-class UnreadThreadsCountMiddleware(object):
+class UnreadThreadsCountMiddleware(MiddlewareMixin):
     def process_request(self, request):
     def process_request(self, request):
         if request.user.is_anonymous():
         if request.user.is_anonymous():
             return
             return

+ 1 - 1
misago/threads/models/attachment.py

@@ -4,7 +4,6 @@ from io import BytesIO
 
 
 from PIL import Image
 from PIL import Image
 
 
-from django.conf import settings
 from django.core.files import File
 from django.core.files import File
 from django.core.files.base import ContentFile
 from django.core.files.base import ContentFile
 from django.db import models
 from django.db import models
@@ -13,6 +12,7 @@ from django.utils import timezone
 from django.utils.crypto import get_random_string
 from django.utils.crypto import get_random_string
 from django.utils.encoding import python_2_unicode_compatible
 from django.utils.encoding import python_2_unicode_compatible
 
 
+from misago.conf import settings
 from misago.core.utils import slugify
 from misago.core.utils import slugify
 
 
 
 

+ 1 - 1
misago/threads/tests/test_attachments_api.py

@@ -3,13 +3,13 @@ import os
 
 
 from PIL import Image
 from PIL import Image
 
 
-from django.conf import settings
 from django.urls import reverse
 from django.urls import reverse
 from django.utils import six
 from django.utils import six
 from django.utils.encoding import smart_str
 from django.utils.encoding import smart_str
 
 
 from misago.acl.models import Role
 from misago.acl.models import Role
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
+from misago.conf import settings
 from misago.users.testutils import AuthenticatedUserTestCase
 from misago.users.testutils import AuthenticatedUserTestCase
 
 
 from ..models import Attachment, AttachmentType
 from ..models import Attachment, AttachmentType

+ 1 - 2
misago/threads/tests/test_attachments_middleware.py

@@ -1,9 +1,8 @@
-from django.conf import settings
-
 from rest_framework import serializers
 from rest_framework import serializers
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
+from misago.conf import settings
 from misago.users.testutils import AuthenticatedUserTestCase
 from misago.users.testutils import AuthenticatedUserTestCase
 
 
 from .. import testutils
 from .. import testutils

+ 1 - 1
misago/threads/tests/test_attachmentview.py

@@ -1,11 +1,11 @@
 import os
 import os
 
 
-from django.conf import settings
 from django.urls import reverse
 from django.urls import reverse
 
 
 from misago.acl.models import Role
 from misago.acl.models import Role
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
+from misago.conf import settings
 from misago.users.testutils import AuthenticatedUserTestCase
 from misago.users.testutils import AuthenticatedUserTestCase
 
 
 from .. import testutils
 from .. import testutils

+ 1 - 1
misago/threads/tests/test_clearattachments.py

@@ -1,12 +1,12 @@
 from datetime import timedelta
 from datetime import timedelta
 
 
-from django.conf import settings
 from django.core.management import call_command
 from django.core.management import call_command
 from django.test import TestCase
 from django.test import TestCase
 from django.utils import timezone
 from django.utils import timezone
 from django.utils.six import StringIO
 from django.utils.six import StringIO
 
 
 from misago.categories.models import Category
 from misago.categories.models import Category
+from misago.conf import settings
 
 
 from .. import testutils
 from .. import testutils
 from ..management.commands import clearattachments
 from ..management.commands import clearattachments

+ 1 - 1
misago/threads/tests/test_threadslists.py

@@ -1,7 +1,6 @@
 from datetime import timedelta
 from datetime import timedelta
 from json import loads as json_loads
 from json import loads as json_loads
 
 
-from django.conf import settings
 from django.urls import reverse
 from django.urls import reverse
 from django.utils import timezone
 from django.utils import timezone
 from django.utils.encoding import smart_str
 from django.utils.encoding import smart_str
@@ -9,6 +8,7 @@ from django.utils.six.moves import range
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
+from misago.conf import settings
 from misago.core import threadstore
 from misago.core import threadstore
 from misago.core.cache import cache
 from misago.core.cache import cache
 from misago.readtracker import categoriestracker, threadstracker
 from misago.readtracker import categoriestracker, threadstracker

+ 1 - 1
misago/threads/threadtypes/treesmap.py

@@ -1,6 +1,6 @@
 from importlib import import_module
 from importlib import import_module
 
 
-from django.conf import settings
+from misago.conf import settings
 
 
 
 
 class TreesMap(object):
 class TreesMap(object):

+ 2 - 1
misago/threads/urls/__init__.py

@@ -1,6 +1,7 @@
-from django.conf import settings
 from django.conf.urls import url
 from django.conf.urls import url
 
 
+from misago.conf import settings
+
 from ..views.attachment import attachment_server
 from ..views.attachment import attachment_server
 from ..views.goto import (
 from ..views.goto import (
     ThreadGotoPostView, ThreadGotoLastView, ThreadGotoNewView, ThreadGotoUnapprovedView,
     ThreadGotoPostView, ThreadGotoLastView, ThreadGotoNewView, ThreadGotoUnapprovedView,

+ 1 - 2
misago/threads/viewmodels/posts.py

@@ -1,6 +1,5 @@
-from django.conf import settings
-
 from misago.acl import add_acl
 from misago.acl import add_acl
+from misago.conf import settings
 from misago.core.shortcuts import paginate, pagination_dict
 from misago.core.shortcuts import paginate, pagination_dict
 from misago.readtracker.threadstracker import make_posts_read_aware
 from misago.readtracker.threadstracker import make_posts_read_aware
 from misago.users.online.utils import make_users_status_aware
 from misago.users.online.utils import make_users_status_aware

+ 1 - 1
misago/threads/viewmodels/threads.py

@@ -1,6 +1,5 @@
 from datetime import timedelta
 from datetime import timedelta
 
 
-from django.conf import settings
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.db.models import F, Q
 from django.db.models import F, Q
 from django.http import Http404
 from django.http import Http404
@@ -9,6 +8,7 @@ from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext_lazy
 from django.utils.translation import ugettext_lazy
 
 
 from misago.acl import add_acl
 from misago.acl import add_acl
+from misago.conf import settings
 from misago.core.shortcuts import paginate, pagination_dict
 from misago.core.shortcuts import paginate, pagination_dict
 from misago.readtracker import threadstracker
 from misago.readtracker import threadstracker
 
 

+ 2 - 1
misago/threads/views/attachment.py

@@ -2,12 +2,13 @@ from __future__ import unicode_literals
 
 
 import os
 import os
 
 
-from django.conf import settings
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.db.models import F
 from django.db.models import F
 from django.http import Http404
 from django.http import Http404
 from django.shortcuts import get_object_or_404, redirect
 from django.shortcuts import get_object_or_404, redirect
 
 
+from misago.conf import settings
+
 from ..models import Attachment, AttachmentType
 from ..models import Attachment, AttachmentType
 
 
 
 

+ 1 - 1
misago/urls.py

@@ -1,7 +1,7 @@
-from django.conf import settings
 from django.conf.urls import include, url
 from django.conf.urls import include, url
 from django.views.generic import TemplateView
 from django.views.generic import TemplateView
 
 
+from misago.conf import settings
 from misago.core.views import forum_index
 from misago.core.views import forum_index
 
 
 
 

+ 1 - 1
misago/users/activepostersranking.py

@@ -1,11 +1,11 @@
 from datetime import timedelta
 from datetime import timedelta
 
 
-from django.conf import settings
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.db.models import Count
 from django.db.models import Count
 from django.utils import timezone
 from django.utils import timezone
 
 
 from misago.categories.models import Category
 from misago.categories.models import Category
+from misago.conf import settings
 
 
 from .models import ActivityRanking
 from .models import ActivityRanking
 
 

+ 2 - 1
misago/users/avatars/gallery.py

@@ -3,9 +3,10 @@ import random
 from path import Path
 from path import Path
 from PIL import Image
 from PIL import Image
 
 
-from django.conf import settings
 from django.core.files.base import ContentFile
 from django.core.files.base import ContentFile
 
 
+from misago.conf import settings
+
 from . import store
 from . import store
 
 
 
 

+ 4 - 3
misago/users/middleware.py

@@ -2,13 +2,14 @@ import pytz
 
 
 from django.contrib.auth import logout
 from django.contrib.auth import logout
 from django.contrib.auth.models import AnonymousUser as DjAnonymousUser
 from django.contrib.auth.models import AnonymousUser as DjAnonymousUser
+from django.utils.deprecation import MiddlewareMixin
 
 
 from .bans import get_request_ip_ban, get_user_ban
 from .bans import get_request_ip_ban, get_user_ban
 from .models import AnonymousUser, Online
 from .models import AnonymousUser, Online
 from .online import tracker
 from .online import tracker
 
 
 
 
-class RealIPMiddleware(object):
+class RealIPMiddleware(MiddlewareMixin):
     def process_request(self, request):
     def process_request(self, request):
         x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
         x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
         if x_forwarded_for:
         if x_forwarded_for:
@@ -17,7 +18,7 @@ class RealIPMiddleware(object):
             request.user_ip = request.META.get('REMOTE_ADDR')
             request.user_ip = request.META.get('REMOTE_ADDR')
 
 
 
 
-class UserMiddleware(object):
+class UserMiddleware(MiddlewareMixin):
     def process_request(self, request):
     def process_request(self, request):
         if request.user.is_anonymous():
         if request.user.is_anonymous():
             request.user = AnonymousUser()
             request.user = AnonymousUser()
@@ -27,7 +28,7 @@ class UserMiddleware(object):
                 request.user = AnonymousUser()
                 request.user = AnonymousUser()
 
 
 
 
-class OnlineTrackerMiddleware(object):
+class OnlineTrackerMiddleware(MiddlewareMixin):
     def process_request(self, request):
     def process_request(self, request):
         if request.user.is_authenticated():
         if request.user.is_authenticated():
             try:
             try:

+ 2 - 1
misago/users/tests/test_avatarserver_views.py

@@ -1,8 +1,9 @@
-from django.conf import settings
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.test import TestCase
 from django.test import TestCase
 from django.urls import reverse
 from django.urls import reverse
 
 
+from misago.conf import settings
+
 
 
 class AvatarServerTests(TestCase):
 class AvatarServerTests(TestCase):
     def setUp(self):
     def setUp(self):

+ 1 - 2
misago/users/viewmodels/threads.py

@@ -1,6 +1,5 @@
-from django.conf import settings
-
 from misago.acl import add_acl
 from misago.acl import add_acl
+from misago.conf import settings
 from misago.core.shortcuts import paginate, pagination_dict
 from misago.core.shortcuts import paginate, pagination_dict
 from misago.readtracker import threadstracker
 from misago.readtracker import threadstracker
 from misago.threads.permissions import exclude_invisible_threads
 from misago.threads.permissions import exclude_invisible_threads

+ 2 - 1
misago/users/views/avatarserver.py

@@ -1,8 +1,9 @@
-from django.conf import settings
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.contrib.staticfiles.templatetags.staticfiles import static
 from django.contrib.staticfiles.templatetags.staticfiles import static
 from django.shortcuts import redirect
 from django.shortcuts import redirect
 
 
+from misago.conf import settings
+
 
 
 def user_avatar(request, pk, size):
 def user_avatar(request, pk, size):
     User = get_user_model()
     User = get_user_model()

+ 1 - 1
misago/users/views/lists.py

@@ -1,11 +1,11 @@
 import six
 import six
 
 
-from django.conf import settings
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.shortcuts import render as django_render
 from django.shortcuts import render as django_render
 from django.shortcuts import redirect
 from django.shortcuts import redirect
 from django.urls import reverse
 from django.urls import reverse
 
 
+from misago.conf import settings
 from misago.core.shortcuts import get_object_or_404, paginate, pagination_dict
 from misago.core.shortcuts import get_object_or_404, paginate, pagination_dict
 from misago.core.utils import format_plaintext_for_html
 from misago.core.utils import format_plaintext_for_html
 
 

+ 1 - 1
misago/users/views/profile.py

@@ -1,4 +1,3 @@
-from django.conf import settings
 from django.contrib import messages
 from django.contrib import messages
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
@@ -11,6 +10,7 @@ from django.utils import six
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 
 
 from misago.acl import add_acl
 from misago.acl import add_acl
+from misago.conf import settings
 from misago.core.decorators import require_POST
 from misago.core.decorators import require_POST
 from misago.core.shortcuts import get_object_or_404, paginate, pagination_dict, validate_slug
 from misago.core.shortcuts import get_object_or_404, paginate, pagination_dict, validate_slug
 from misago.core.utils import clean_return_path
 from misago.core.utils import clean_return_path