Skip to main content

Basic Static Asset Middleware for Django

Project description

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 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.

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_sam-0.0.1.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

django_sam-0.0.1-py3-none-any.whl (4.2 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