Skip to main content

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

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_dynamic_theme-0.0.10.tar.gz (9.9 kB view hashes)

Uploaded Source

Built Distribution

django_dynamic_theme-0.0.10-py3-none-any.whl (19.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page