Skip to content

Admin extensions to make theming django sites easier for end users

License

Notifications You must be signed in to change notification settings

LegoStormtroopr/django-themes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-themes

In brief: Admin extensions to make theming django sites easier for end users of django sites.

Goals

  • Serve themes for django using built-in Django FileStorage api - this means themes can be served from FileSystem, Cloud storage (such as Amazon S3) or from the database
  • Follow django admin design, to help it feel like a Django-native process
  • Above all: Give end users more control over how their django apps look and behave, without having to change the code used to deploy the app.

How to install & configure

  1. Install it from PyPI

  2. Add Django themes to your INSTALLED_APPS. Django-themes doesn't override anything, so you can put this anywhere in the order:

    INSTALLED_APPS = (
      # ... your other apps
      'django_themes',
    )
    
  3. Add theme directives:

    THEMES_FILE_ROOT = os.getenv('DJANGO_THEMES_ROOT', os.path.join(BASE_DIR, "themes")) # Where your themes are
    THEMES_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage' # Or whatever storage you need
    
  4. If you want to be able to preview themes live, add the appropriate middleware after everything else. Note: to get the current user during template loading, this needs to store the user of a request in _thread_locals. I've read that some Django core devs consider this a security issue, but most people are ok with it.:

    MIDDLEWARE_CLASSES = (
    
      'django_themes.middleware.PreviewWithCurrentUserMiddleware',
    )
    

See it in action

Drag-and-drop files to add them

Adding a file

Preview changes to themes before they are active

Previewing a change

Resources

This package uses the following open-source resources:

About

Admin extensions to make theming django sites easier for end users

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages