diff --git a/dockerfiles/settings/proxito.py b/dockerfiles/settings/proxito.py index 3e8616ed9d9..d301d625f01 100644 --- a/dockerfiles/settings/proxito.py +++ b/dockerfiles/settings/proxito.py @@ -1,25 +1,14 @@ +from readthedocs.settings.proxito.base import CommunityProxitoSettingsMixin + from .docker_compose import DockerBaseSettings -class ProxitoDevSettings(DockerBaseSettings): - ROOT_URLCONF = 'readthedocs.proxito.urls' +class ProxitoDevSettings(CommunityProxitoSettingsMixin, DockerBaseSettings): # El Proxito does not have django-debug-toolbar installed DEBUG_TOOLBAR_CONFIG = { 'SHOW_TOOLBAR_CALLBACK': lambda request: False, } - @property - def MIDDLEWARE(self): # noqa - classes = list(super().MIDDLEWARE) - index = classes.index( - 'readthedocs.core.middleware.SubdomainMiddleware' - ) - # Use our new middleware instead of the old one - classes[index] = 'readthedocs.proxito.middleware.ProxitoMiddleware' - classes.remove('readthedocs.core.middleware.SingleVersionMiddleware') - classes.remove('django.middleware.locale.LocaleMiddleware') - - return tuple(classes) ProxitoDevSettings.load_settings(__name__) diff --git a/readthedocs/settings/proxito/__init__.py b/readthedocs/settings/proxito/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/readthedocs/settings/proxito.py b/readthedocs/settings/proxito/base.py similarity index 59% rename from readthedocs/settings/proxito.py rename to readthedocs/settings/proxito/base.py index 05d365d10cf..8bca12d2933 100644 --- a/readthedocs/settings/proxito.py +++ b/readthedocs/settings/proxito/base.py @@ -1,24 +1,15 @@ """ -Local setting for Proxito +Base settings for Proxito -These settings will eventually be backported into the main settings file, +Some of these settings will eventually be backported into the main settings file, but currently we have them to be able to run the site with the old middleware for a staged rollout of the proxito code. """ -# pylint: disable=missing-docstring - -import os - -from readthedocs.settings import base - - -class ProxitoDevSettings(base.CommunityBaseSettings): +class CommunityProxitoSettingsMixin: ROOT_URLCONF = 'readthedocs.proxito.urls' USE_SUBDOMAIN = True - PUBLIC_DOMAIN = 'community.dev.readthedocs.io' - PUBLIC_DOMAIN_USES_HTTPS = False @property def MIDDLEWARE(self): # noqa @@ -39,13 +30,3 @@ def MIDDLEWARE(self): # noqa classes.remove(mw) return classes - - -ProxitoDevSettings.load_settings(__name__) - -if not os.environ.get('DJANGO_SETTINGS_SKIP_LOCAL', False): - try: - # pylint: disable=unused-wildcard-import - from .local_settings import * # noqa - except ImportError: - pass diff --git a/readthedocs/settings/proxito/test.py b/readthedocs/settings/proxito/test.py new file mode 100644 index 00000000000..c10d97ddd3f --- /dev/null +++ b/readthedocs/settings/proxito/test.py @@ -0,0 +1,13 @@ +from ..test import CommunityTestSettings +from .base import ProxitoSettingsMixin + + +class CommunityProxitoTestSettings( + ProxitoSettingsMixin, + CommunityTestSettings +): + + pass + + +CommunityProxitoTestSettings.load_settings(__name__)