Skip to content

Segelzwerg/django-dynamic-theme

Repository files navigation

PyPI - Python Version GitHub Release

Documentation Status codecov

Django Dynamic Theme

This allows an administrator of a django website to change the theme on the fly.

Installation

pip install django-dynamic-theme

Quickstart

  1. Add the following settings::
INSTALLED_APPS = [
  ...,
  "django_dynamic_theme",
  "compressor",
]
...
# Default setting but you can set it to some other path.
STATIC_URL = "static/"
STATIC_ROOT = "static"
STATICFILES_FINDERS = [
    ...,
    "compressor.finders.CompressorFinder",
]
COMPRESS_PRECOMPILERS = (("text/x-scss", "django_libsass.SassCompiler"),)
MIDDLEWARE = [
    ...,
    "django_dynamic_theme.middleware.MissingThemeHandleMiddleware",
]
TEMPLATES = {
  "OPTIONS": {
    "context_processors": [
      ...,
      "django_dynamic_theme-context_processor.theme",
    ]
  }
}
  1. Run python manage.py migrate

  2. Assuming you have base.html add this to it before the <body> tag:

<html>
  ...
  {% load compress %}
  {% load static %}
  {% compress css %}
  <link type="text/x-scss" rel="stylesheet" href="{% static theme_file %}" />
  ...
</html>
  1. Visit http://127.0.0.1:8000/admin/django_dynamic_theme/ to start customizing your theme.

About

This enables the administrator of a django website to change the theme on the fly.

Resources

License

Security policy

Stars

Watchers

Forks

Languages