Skip to main content

Drop-in replacement for staticfiles which handles asset processing.

Project description

Django Assetfiles

Django Assetfiles is a drop-in replacement for staticfiles which handles asset processing.


1. Install package from PyPi:

``` sh
$ pip install django-assetfiles

2. Replace `'django.contrib.staticfiles'` in `INSTALLED_APPS` with `'assetfiles'`:

``` python
# ...
# 'django.contrib.staticfiles',

3. That's it! Assetfiles will default to your [Staticfiles settings](


1. Add an asset file that should be processed:

``` scss
// static/css/main.scss
$color: red;

body {
color: $color;

2. Add a link to the processed CSS file in your template (you can use standard Staticfiles conventions):

``` html+django
{% load staticfiles %}
<link href="{% static 'css/main.css' %}" rel="stylesheet">

Assetfiles will automatically serve up the processed version of `main.scss` at the static url of `/static/css/main.css`.

4. To serve assets in development, either use `runserver` as normal or add the following to your ``:

``` python
from assetfiles.urls import assetfiles_urlpatterns

# ... the rest of your URLconf goes here ...

urlpatterns += assetfiles_urlpatterns()

5. For deployment, run `collectstatic` as usual and Assetfiles will process and copy over the assets:

``` sh
$ python collectstatic
$ cat public/css/main.css
body {
color: red; }


Copyright (c) 2012 [LocalMed, Inc.]( See LICENSE for details.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-assetfiles, version 0.8.0
Filename, size File type Python version Upload date Hashes
Filename, size django-assetfiles-0.8.0.tar.gz (17.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page