This is a Django app that provides helpers for serving static files.
For small projects, this isn’t a big deal, because you can just keep the media somewhere your web server can find it. However, in bigger projects – especially those comprised of multiple apps – dealing with the multiple sets of static files provided by each application starts to get tricky.
staticfiles is for:
Collecting static files from each of your Django apps (and any other place you specify) into a single location that can easily be served in production.
The main website for django-staticfiles is github.com/jezdez/django-staticfiles where you can also file tickets.
django-staticfiles is now part of Django (since 1.3) as
The django-staticfiles 0.3.X series will only receive security and data los bug fixes after the release of django-staticfiles 1.0. Any Django 1.2.X project using django-staticfiles 0.3.X and lower should be upgraded to use either Django >= 1.3’s staticfiles app or django-staticfiles >= 1.0 to profit from the new features and stability.
You may want to chose to use django-staticfiles instead of Django’s own staticfiles app since any new feature (additionally to those backported from Django) will be released first in django-staticfiles.
Use your favorite Python packaging tool to install
staticfilesfrom PyPI, e.g.:
pip install django-staticfiles
You can also install the in-development version of django-staticfiles with
pip install django-staticfiles==dev.
INSTALLED_APPS = [ # ... "staticfiles", ]
STATIC_URLsetting to the URL that handles serving static files:
STATIC_URL = "/static/"
In development mode (when
DEBUG = True) the
runservercommand will automatically serve static files:
python manage.py runserver
Once you are ready to deploy all static files of your site in a central directory (
STATIC_ROOT) to be served by a real webserver (e.g. Apache, Cherokee, Lighttpd, Nginx etc.), use the
python manage.py collectstatic
See the webserver’s documentation for descriptions how to setup serving the deployment directory (
(optional) In case you use Django’s admin app, make sure the
ADMIN_MEDIA_PREFIXsetting is set correctly to a subpath of
ADMIN_MEDIA_PREFIX = STATIC_URL + "admin/"
django-staticfiles which Django’s
- Runs on Django 1.2.X.
STATICFILES_EXCLUDED_APPSsettings – A sequence of dotted app paths that should be ignored when searching for static files.
STATICFILES_IGNORE_PATTERNSsettings – A sequence of glob patterns of files and directories to ignore when running
- Legacy ‘media’ dir file finder – a staticfiles finder that supports the
location for static files that a lot of 3rd party apps support
See the Settings docs for more information.
- Management Commands
- v1.2.1 (2012-02-16)
- v1.2 (2012-02-12)
- v1.1.2 (2011-08-25)
- v1.1.1 (2011-08-22)
- v1.1 (2011-08-18)
- v1.0.1 (2011-03-28)
- v1.0 (2011-03-23)
- v0.3.4 (2010-12-25)
- v0.3.3 (2010-12-23)
- v0.3.2 (2010-08-27)
- v0.3.1 (2010-08-21)
- v0.3.0 (2010-08-18)
- v0.2.0 (2009-11-25)
- v0.1.2 (2009-09-02)
- v0.1.1 (2009-09-02)
- v0.1.0 (2009-09-02)