edx-django-sites-extensions

raw JSON →
6.0.0 verified Mon Apr 27 auth: no python

Custom extensions for the Django sites framework, primarily used in the Open edX platform. Current version is 6.0.0, released in 2024. Release cadence is irregular, with occasional minor and patch releases.

pip install edx-django-sites-extensions
error ModuleNotFoundError: No module named 'site_config_client'
cause The package 'edx-django-sites-extensions' does not expose a top-level 'site_config_client' module. The actual module name may differ.
fix
Check the imports in the documentation. The library's main module might be 'edx_django_sites_extensions' or similar.
error ImportError: cannot import name 'SiteConfigurationModel'
cause The model name or import path is incorrect.
fix
Verify the correct import path from the library's models module. For example: from edx_django_sites_extensions.models import SiteConfigurationModel
breaking Version 4.0.0 dropped support for Django 2.2 and earlier. Upgrade your Django version if pinning to older versions.
fix Upgrade to Django 3.2+ and update to edx-django-sites-extensions>=4.0.0.
deprecated Python 3.8 support was dropped in version 5.1.0. Python 3.8 users must stay on <5.1.0.
fix Use Python 3.9+ or pin to <5.1.0.
gotcha The library is tightly coupled to Open edX and may not be directly usable in standalone Django projects without additional configuration.
fix Ensure you have the required Open edX app set up, or use django.contrib.sites directly.

Retrieve or create a SiteConfigurationModel for the current site and set a key.

from django.contrib.sites.models import Site
from site_config_client.models import SiteConfigurationModel

site = Site.objects.get_current()
config, created = SiteConfigurationModel.objects.get_or_create(site=site)
config.values = {'key': os.environ.get('SAMPLE_KEY', 'default')}
config.save()