Skip to content

Commit

Permalink
depr: drop the possibility of overriding edx-platform settings
Browse files Browse the repository at this point in the history
Previously, it was possible to override settings by defining the
TUTOR_EDX_PLATFORM_SETTINGS environment variable. But let's face it:

- It was not very well supported.
- It was poorly explained.
- It was not very useful.
- It causes unnecessary code complexity.

For these reasons, we drop that feature.
  • Loading branch information
regisb committed Apr 15, 2022
1 parent 15b219e commit 5de7bec
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 47 deletions.
25 changes: 0 additions & 25 deletions docs/dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,31 +178,6 @@ You will have to re-build the openedx Docker image once::

You should then run the development server as usual, with ``runserver``. Every change made to the ``mypackage`` folder will be picked up and the development server will be automatically reloaded.

Loading custom edx-platform settings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

By default, tutor settings files are mounted inside the docker images at ``/openedx/edx-platform/lms/envs/tutor/`` and ``/openedx/edx-platform/cms/envs/tutor/``. In the various ``dev`` commands, the default ``edx-platform`` settings module is set to ``tutor.development`` and you don't have to do anything to set up these settings.

If for some reason, you want to use different settings, you will need to define the ``TUTOR_EDX_PLATFORM_SETTINGS`` environment variable.

For instance, let's assume you have created the ``/path/to/edx-platform/lms/envs/mysettings.py`` and ``/path/to/edx-platform/cms/envs/mysettings.py`` modules. These settings should be pretty similar to the following files::

$(tutor config printroot)/env/apps/openedx/tutor/lms/development.py
$(tutor config printroot)/env/apps/openedx/tutor/cms/development.py

Alternatively, the ``mysettings.py`` files can import the tutor development settings::

# Beginning of mysettings.py
from .tutor.development import *

You should then specify the settings to use on the host::

export TUTOR_EDX_PLATFORM_SETTINGS=mysettings

From then on, all ``dev`` commands will use the ``mysettings`` module. For instance::

tutor dev runserver lms

Running edx-platform unit tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
9 changes: 0 additions & 9 deletions docs/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,6 @@ This might occur when you run a ``paver`` command. ``/dev/null`` eats the actual

The error produced should help you better understand what is happening.

"ValueError: Unable to configure handler 'local'"
---------------------------------------------------

::

ValueError: Unable to configure handler 'local': [Errno 2] No such file or directory

This will occur if you try to run a development environment without patching the LOGGING configuration, as indicated in the `development_` section. Maybe you correctly patched the development settings, but they are not taken into account? For instance, you might have correctly defined the ``TUTOR_EDX_PLATFORM_SETTINGS`` environment variable, but ``paver`` uses the ``devstack`` settings (which does not patch the ``LOGGING`` variable). This is because calling ``paver lms --settings=development`` or ``paver cms --settings=development`` ignores the ``--settings`` argument. Yes, it might be considered an edx-platform bug... Instead, you should run the ``update_assets`` and ``runserver`` commands, as explained above.

The chosen default language does not display properly
-----------------------------------------------------

Expand Down
7 changes: 1 addition & 6 deletions docs/tutorials/edx-platform-settings.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
Modifying ``edx-platform`` settings
-----------------------------------

The default settings module loaded by ``edx-platform`` is ``tutor.production`` in production and ``tutor.development`` in development. The folders ``$(tutor config printroot)/env/apps/openedx/settings/lms`` and ``$(tutor config printroot)/env/apps/openedx/settings/cms`` are mounted as ``edx-platform/lms/envs/tutor`` and ``edx-platform/cms/envs/tutor`` inside the docker containers. Thus, to use your own settings, you must do two things:

1. Copy your settings files for the lms and the cms to ``$(tutor config printroot)/env/apps/openedx/settings/lms/mysettings.py`` and ``$(tutor config printroot)/env/apps/openedx/settings/cms/mysettings.py``.
2. Load your settings by adding ``TUTOR_EDX_PLATFORM_SETTINGS=tutor.mysettings`` to ``$(tutor config printroot)/env/local/.env``.

Of course, your settings should be compatible with the docker installation. You can get some inspiration from the ``production.py`` settings modules generated by Tutor, or just import it as a base by adding ``from .production import *`` at the top of ``mysettings.py``.
The default settings module loaded by ``edx-platform`` is ``tutor.production`` in production and ``tutor.development`` in development. The folders ``$(tutor config printroot)/env/apps/openedx/settings/lms`` and ``$(tutor config printroot)/env/apps/openedx/settings/cms`` are mounted as ``edx-platform/lms/envs/tutor`` and ``edx-platform/cms/envs/tutor`` inside the docker containers. To modify these settings you must create a plugin that implements one or more of the patch statements in those setting files. See the :ref:`plugin_development_tutorial` tutorial for more information on how to create a plugin.
2 changes: 1 addition & 1 deletion tutor/templates/dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ x-openedx-service:
args:
APP_USER_ID: "{{ HOST_USER_ID }}"
environment:
SETTINGS: ${TUTOR_EDX_PLATFORM_SETTINGS:-tutor.development}
SETTINGS: tutor.development
volumes:
# Settings & config
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
Expand Down
4 changes: 2 additions & 2 deletions tutor/templates/local/docker-compose.jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
image: {{ DOCKER_IMAGE_OPENEDX }}
environment:
SERVICE_VARIANT: lms
SETTINGS: ${TUTOR_EDX_PLATFORM_SETTINGS:-tutor.production}
SETTINGS: tutor.production
volumes:
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
- ../apps/openedx/settings/cms:/openedx/edx-platform/cms/envs/tutor:ro
Expand All @@ -20,7 +20,7 @@ services:
image: {{ DOCKER_IMAGE_OPENEDX }}
environment:
SERVICE_VARIANT: cms
SETTINGS: ${TUTOR_EDX_PLATFORM_SETTINGS:-tutor.production}
SETTINGS: tutor.production
volumes:
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
- ../apps/openedx/settings/cms:/openedx/edx-platform/cms/envs/tutor:ro
Expand Down
8 changes: 4 additions & 4 deletions tutor/templates/local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ services:
environment:
SERVICE_VARIANT: lms
UWSGI_WORKERS: {{ OPENEDX_LMS_UWSGI_WORKERS }}
SETTINGS: ${TUTOR_EDX_PLATFORM_SETTINGS:-tutor.production}
SETTINGS: tutor.production
restart: unless-stopped
volumes:
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
Expand Down Expand Up @@ -136,7 +136,7 @@ services:
environment:
SERVICE_VARIANT: cms
UWSGI_WORKERS: {{ OPENEDX_CMS_UWSGI_WORKERS }}
SETTINGS: ${TUTOR_EDX_PLATFORM_SETTINGS:-tutor.production}
SETTINGS: tutor.production
restart: unless-stopped
volumes:
- ../apps/openedx/settings/lms:/openedx/edx-platform/lms/envs/tutor:ro
Expand Down Expand Up @@ -169,7 +169,7 @@ services:
image: {{ DOCKER_IMAGE_OPENEDX }}
environment:
SERVICE_VARIANT: lms
SETTINGS: ${TUTOR_EDX_PLATFORM_SETTINGS:-tutor.production}
SETTINGS: tutor.production
command: celery worker --app=lms.celery --loglevel=info --hostname=edx.lms.core.default.%%h --maxtasksperchild=100 --exclude-queues=edx.cms.core.default
restart: unless-stopped
volumes:
Expand All @@ -187,7 +187,7 @@ services:
image: {{ DOCKER_IMAGE_OPENEDX }}
environment:
SERVICE_VARIANT: cms
SETTINGS: ${TUTOR_EDX_PLATFORM_SETTINGS:-tutor.production}
SETTINGS: tutor.production
command: celery worker --app=cms.celery --loglevel=info --hostname=edx.cms.core.default.%%h --maxtasksperchild 100 --exclude-queues=edx.lms.core.default
restart: unless-stopped
volumes:
Expand Down

0 comments on commit 5de7bec

Please sign in to comment.