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: it collects media from each of your
applications (and any other places 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 was added to Django 1.3 as a contrib app. For backwards compatible reasons, django-staticfiles 0.3.X series will be the last series to only support Django 1.2.X and lower. Any new features (including those backported from Django) will occur in later releases, e.g. in django-staticfiles>=1.0.X.
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 (