Skip to main content

Complete solution for theming your django site.

Project description

Django Theming

PyPI Travis Codecov Supported Python versions License

The Django Theming is a standalone theming solution for django sites. You can use it customize the look and feel of any of your django site.

Overview

Django theming provides a way for django sites owners to customize the look and feel of django sites without having to alter the code of the base site.

Installation

Install using pip:

pip install djangotheming

Usage

Add 'theming' to your INSTALLED_APPS.

INSTALLED_APPS = [
    ...
    'theming',
]

Add 'django.contrib.sites.middleware.CurrentSiteMiddleware', 'theming.middleware.CurrentRequestMiddleware' and 'theming.middleware.CurrentThemeMiddleware' to your MIDDLEWARE

Add theming.template.loaders.theme.Loader to your 'TEMPLATES['OPTIONS']['loaders']'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')]
        ,
        'APP_DIRS': False,
        'OPTIONS': {
            'loaders': [
                'theming.template.loaders.theme.Loader',
                'django.template.loaders.app_directories.Loader',
            ],
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

Set 'theming.static.storage.ThemeStorage' as your 'STATICFILES_STORAGE'

STATICFILES_STORAGE = "theming.static.storage.ThemeStorage"

Add 'theming.static.finders.ThemeFilesFinder' to your 'STATICFILES_FINDERS'

STATICFILES_FINDERS = (
    'theming.static.finders.ThemeFilesFinder',
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',

)

Finally, Set the 'THEMING' setting to something like.

 #  Theming settings.

 THEMING = {
   'ENABLED': True,
   'DEFAULT': '<theme-name>',
   'DIRS': [

      os.path.join(<absolute-path-to-themes-dir>)

   ],

}

License

The code in this repository is licensed under the GNU GENERAL PUBLIC LICENSE Version 3 unless otherwise noted.

Please see LICENSE for details.

How To Contribute

Contributions are very welcome.

I will add info on how to contribute soon.

Reporting Security Issues

Please do not report security issues in public. Please email saleem_ee@hotmail.com.

Change Log

[0.1.0] - 2016-10-13

  • First release on PyPI.

  • Models and Django admin integration

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

djangotheming-2.0.1.tar.gz (11.3 kB view details)

Uploaded Source

File details

Details for the file djangotheming-2.0.1.tar.gz.

File metadata

  • Download URL: djangotheming-2.0.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for djangotheming-2.0.1.tar.gz
Algorithm Hash digest
SHA256 5c8c94c32f617a56b26c4ca7993ea57191b7b92e28f38d1e82205b62308a61f7
MD5 05b6383fcd43249f998ca0adce4013ab
BLAKE2b-256 5c6c15a231653772ec34984aef386e48c81a00c6c5f11a1da94bcbc8df720984

See more details on using hashes here.

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