Skip to content

A basic sync/async static asset middleware for Django

License

Notifications You must be signed in to change notification settings

GlobalRadio/django-sam

Repository files navigation

Django SAM

A basic sync/async static asset middleware for Django.

Designed to allow simple running of a purely admin Django instance under Daphne without having to worry about hosting admin static assets.

Installation

Install using pip:

pip install django-sam

Add django_sam to Django installed apps in settings.

Add django_sam.middleware.static_admin_middleware to your MIDDLEWARE setting, just after django.middleware.security.SecurityMiddleware

Ensure that Django is configured for static assets generation and that the STATIC_ROOT and STATIC_URL settings are set.

Ensure that static assets have been generated using python manage.py collectstatic.

Serve using Daphne (or the development server while developing).

Caveats

This middleware is deliberately very basic and hasn't been tested for static asset hosting beyond those generated by the Django admin. While it may well work for larger static file projects it is recommended that normal CDN-based static file hosting be used in those cases.

About

A basic sync/async static asset middleware for Django

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published