Skip to content

Commit

Permalink
Dev: invoke options --no-django-debug and --http-domain (#10384)
Browse files Browse the repository at this point in the history
* Adds docker-compose dev options to force HTTPS settings and DEBUG mode through environment

* Remove settings that support https and disables suspicious host checking on Proxito
  • Loading branch information
benjaoming authored Jun 6, 2023
1 parent e3b5484 commit be72682
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion docs/dev/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ save some work while typing docker compose commands. This section explains these
* ``--init`` is used the first time this command is ran to run initial migrations, create an admin user, etc
* ``--no-reload`` makes all celery processes and django runserver
to use no reload and do not watch for files changes
* ``--ngrok`` is useful when it's required to access the local instance from outside (e.g. GitHub webhook)
* ``--no-django-debug`` runs all containers with ``DEBUG=False``
* ``--http-domain`` configures an external domain for the environment (useful for Ngrok or other http proxy).
Note that https proxies aren't supported.
There will also be issues with "suspicious domain" failures on Proxito.
* ``--ext-theme`` to use the new dashboard templates
* ``--webpack`` to start the Webpack dev server for the new dashboard templates

Expand Down
3 changes: 3 additions & 0 deletions readthedocs/settings/docker_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class DockerBaseSettings(CommunityBaseSettings):

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

DEBUG = bool(os.environ.get('RTD_DJANGO_DEBUG', True))

DOCKER_ENABLE = True
RTD_DOCKER_COMPOSE = True
RTD_DOCKER_COMPOSE_VOLUME = 'community_build-user-builds'
Expand Down Expand Up @@ -149,6 +151,7 @@ def DATABASES(self): # noqa
}

ACCOUNT_EMAIL_VERIFICATION = "none"

SESSION_COOKIE_DOMAIN = None
CACHES = {
'default': {
Expand Down
4 changes: 3 additions & 1 deletion readthedocs/storage/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class OverrideHostnameMixin:
See: https://github.com/jschneier/django-storages/pull/658
"""

override_hostname = None # Just the hostname without scheme (eg. 'assets.readthedocs.org')
override_hostname = (
None # Just the hostname without scheme (eg. 'assets.readthedocs.org')
)

def url(self, *args, **kwargs):
url = super().url(*args, **kwargs)
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/storage/s3_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def __init__(self, *args, **kwargs):

class S3StaticStorageMixin:

bucket_name = getattr(settings, 'S3_STATIC_STORAGE_BUCKET', None)
override_hostname = getattr(settings, 'S3_STATIC_STORAGE_OVERRIDE_HOSTNAME', None)
bucket_name = getattr(settings, "S3_STATIC_STORAGE_BUCKET", None)
override_hostname = getattr(settings, "S3_STATIC_STORAGE_OVERRIDE_HOSTNAME", None)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down

0 comments on commit be72682

Please sign in to comment.