Skip to content

Settings: simplify all the settings removing a whole old layer (dev) #9978

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 9 commits into from
Feb 7, 2023
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
86 changes: 0 additions & 86 deletions readthedocs/settings/dev.py

This file was deleted.

17 changes: 13 additions & 4 deletions readthedocs/settings/docker_compose.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os
import socket

from .dev import CommunityDevSettings
from .base import CommunityBaseSettings


class DockerBaseSettings(CommunityDevSettings):
class DockerBaseSettings(CommunityBaseSettings):

"""Settings for local development with Docker"""

Expand Down Expand Up @@ -70,6 +70,9 @@ def RTD_EXT_THEME_DEV_SERVER(self):

RTD_CLEAN_AFTER_BUILD = True

# Disable password validators on development
AUTH_PASSWORD_VALIDATORS = []

@property
def RTD_EMBED_API_EXTERNAL_DOMAINS(self):
domains = super().RTD_EMBED_API_EXTERNAL_DOMAINS
Expand All @@ -84,6 +87,12 @@ def RTD_EMBED_API_EXTERNAL_DOMAINS(self):
@property
def LOGGING(self):
logging = super().LOGGING

logging['handlers']['console']['level'] = 'DEBUG'
logging['formatters']['default']['format'] = '[%(asctime)s] ' + self.LOG_FORMAT
# Allow Sphinx and other tools to create loggers
logging['disable_existing_loggers'] = False

logging['handlers']['console']['formatter'] = 'colored_console'
logging['loggers'].update({
# Disable Django access requests logging (e.g. GET /path/to/url)
Expand Down Expand Up @@ -185,8 +194,8 @@ def DATABASES(self): # noqa
BUILD_COLD_STORAGE_URL = 'http://storage:9000/builds'

STATICFILES_DIRS = [
os.path.join(CommunityDevSettings.SITE_ROOT, 'readthedocs', 'static'),
os.path.join(CommunityDevSettings.SITE_ROOT, 'media'),
os.path.join(CommunityBaseSettings.SITE_ROOT, 'readthedocs', 'static'),
os.path.join(CommunityBaseSettings.SITE_ROOT, 'media'),
]

# Remove the checks on the number of fields being submitted
Expand Down
50 changes: 33 additions & 17 deletions readthedocs/settings/test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from __future__ import absolute_import
import os

from .dev import CommunityDevSettings
from .base import CommunityBaseSettings


class CommunityTestSettings(CommunityDevSettings):
class CommunityTestSettings(CommunityBaseSettings):

"""Settings for testing environment (e.g. tox)"""

SLUMBER_USERNAME = 'test'
SLUMBER_PASSWORD = 'test'
Expand All @@ -13,6 +14,9 @@ class CommunityTestSettings(CommunityDevSettings):
# A bunch of our tests check this value in a returned URL/Domain
PRODUCTION_DOMAIN = 'readthedocs.org'

# Disable password validators on tests
AUTH_PASSWORD_VALIDATORS = []

DEBUG = False
TEMPLATE_DEBUG = False
ELASTICSEARCH_DSL_AUTOSYNC = False
Expand All @@ -26,6 +30,26 @@ class CommunityTestSettings(CommunityDevSettings):
STRIPE_PUBLISHABLE = 'pk_test_'
STRIPE_SECRET = 'sk_test_'

CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'PREFIX': 'docs',
}
}

@property
def DATABASES(self): # noqa
return {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(self.SITE_ROOT, 'dev.db'),
},
'telemetry': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(self.SITE_ROOT, 'telemetry.dev.db'),
},
}

@property
def ES_INDEXES(self): # noqa - avoid pep8 N802
es_indexes = super(CommunityTestSettings, self).ES_INDEXES
Expand All @@ -36,21 +60,13 @@ def ES_INDEXES(self): # noqa - avoid pep8 N802

@property
def LOGGING(self): # noqa - avoid pep8 N802
logging = super(CommunityDevSettings, self).LOGGING
logging = super().LOGGING

logging['handlers']['console']['level'] = 'DEBUG'
logging['formatters']['default']['format'] = '[%(asctime)s] ' + self.LOG_FORMAT
# Allow Sphinx and other tools to create loggers
logging['disable_existing_loggers'] = False
return logging


CommunityTestSettings.load_settings(__name__)

CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'PREFIX': 'docs',
}
}

if not os.environ.get('DJANGO_SETTINGS_SKIP_LOCAL', False):
try:
from .local_settings import * # noqa
except ImportError:
pass