Skip to main content

Serve production static files with Django.

Project description

This is a modification of the original dj-static by Kenneth Reitz (https://pypi.python.org/pypi/dj-static)

This is a simple Django middleware utility that allows you to properly serve static assets from production with a WSGI server like Gunicorn.

Django doesn’t recommend the production use of its static file server for a number of reasons. There exists, however, a lovely WSGI application aptly named Static.

It is suitable for the production use of static file serving, unlike Django.

Usage

Configure your static assets in settings.py:

STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'

Then, update your wsgi.py file to use dj-static:

from django.core.wsgi import get_wsgi_application
from dj_static import Cling

application = Cling(get_wsgi_application())

or:

from django.core.wsgi import get_wsgi_application
from dj_static import Cling
import static

class BaseCling(static.Cling):
    ...

application = Cling(get_wsgi_application(), cling_class=BaseCling)

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

dj-static-jl-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file dj-static-jl-0.1.0.tar.gz.

File metadata

  • Download URL: dj-static-jl-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dj-static-jl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3647db41e03db6cd9f9f4f8c0e4df10bc42264a01f5345872046a383ff0de971
MD5 1f7cc83aeeae637395ef9737f367c9dc
BLAKE2b-256 f0dd57a7e86da477d8453f9019d1a87c027398f1b58168ff4e40777403225c22

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page