Skip to content

Add test settings file for proxito #6623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions dockerfiles/settings/proxito.py
Original file line number Diff line number Diff line change
@@ -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__)
Empty file.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -30,14 +21,4 @@ def MIDDLEWARE(self): # noqa
)
classes[index] = 'readthedocs.proxito.middleware.ProxitoMiddleware'
classes.remove('readthedocs.core.middleware.SingleVersionMiddleware')
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
return tuple(classes)
13 changes: 13 additions & 0 deletions readthedocs/settings/proxito/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from ..test import CommunityTestSettings
from .base import ProxitoSettingsMixin


class CommunityProxitoTestSettings(
ProxitoSettingsMixin,
CommunityTestSettings
):

pass


CommunityProxitoTestSettings.load_settings(__name__)