Django Static Files: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Category:Django Category:Web Development == Overview == Collection of information about how to manage static files with Django. == Settings == Place app-specific st...") |
|||
| Line 27: | Line 27: | ||
* [https://docs.djangoproject.com/en/1.9/howto/static-files/ Managing Static Files] - Django documentation | * [https://docs.djangoproject.com/en/1.9/howto/static-files/ Managing Static Files] - Django documentation | ||
* [https://docs.djangoproject.com/en/1.9/howto/static-files/deployment/ Deploying Static Files] - Django documentation | * [https://docs.djangoproject.com/en/1.9/howto/static-files/deployment/ Deploying Static Files] - Django documentation | ||
* [https://docs.djangoproject.com/en/1.9/ref/settings/#settings-staticfiles Static Files Settings] - Django documentation | |||
* [https://docs.djangoproject.com/en/1.9/ref/contrib/staticfiles/ django.contrib.staticfiles app] - Django documentation | |||
Revision as of 01:26, 12 February 2016
Overview
Collection of information about how to manage static files with Django.
Settings
Place app-specific static resources in the app's directory, e.g. myapp/static/myapp/images/myapp-bg.png. When looking up static resources, Django will place the first file that matches a name. Placing the file inside the app's directory effectively namespaces it.
Reference the asset in Django templates using the static template tag:
<link rel="stylesheet" type="text/css" href="{% static 'myapp/app.css' %}">
Or with the static function in Jinja2 templates:
<link rel="stylesheet" type="text/css" href="{{ static('myapp/app.css') }}">
Notes
See also
- Writing Your First Django App, Part 6 - Django documentation
- Managing Static Files - Django documentation
- Deploying Static Files - Django documentation
- Static Files Settings - Django documentation
- django.contrib.staticfiles app - Django documentation