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

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.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

django_sam-0.0.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file django_sam-0.0.2.tar.gz.

File metadata

  • Download URL: django_sam-0.0.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for django_sam-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8b8d5ac4dd5195a791bc46bf64ac10b7f86a03338459fe389b2337b77348dc04
MD5 430b202d0bf7e87b7c11a6a9f9d272f5
BLAKE2b-256 30ff4750ed9b039409bce0410b434d6023a7881c9a02682d1edce3e25d1194ff

See more details on using hashes here.

File details

Details for the file django_sam-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: django_sam-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for django_sam-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 be84458c2fb33d313a36b45153c7ff55907f1267ed1bc6e6bd37b013194092a0
MD5 a401b4a1262e5970471262f420acaf2d
BLAKE2b-256 f6cfad39872870ea0a5613d17aeadc33168936d28a0f4152010ac722662d17b1

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