Skip to content

Commit be64549

Browse files
committed
Add project's static to statifiles_dirs. Fixes tobami#166
1 parent f400be4 commit be64549

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,31 +121,32 @@ the appropriate block:
121121
My Project's Speed Center
122122
{% endblock %}
123123

124-
* Custom logo: Place your logo in `sample_project/override/media/img` and add a block like
125-
this:
124+
* Replacing logo.png: Place your logo in `sample_project/static/images/logo.png`
125+
* Logo with custom filename: Place your logo in `sample_project/static/images/` and add a block like
126+
this to `base_site.html`:
126127

127128
{% block logo %}
128-
<img src="{{ MEDIA_URL }}override/img/my-logo.png" width="120" height="48" alt="My Project">
129+
<img src="{{ MEDIA_URL }}images/my-logo.jpg" width="120" height="48" alt="My Project">
129130
{% endblock logo %}
130131

131132
n.b. the layout will stay exactly the same for any image with a height of
132133
48px (any width will do)
133134

134-
* Custom JavaScript or CSS: add your files to the `sample_project/override/media` directory
135+
* Custom JavaScript or CSS: add your files to the `sample_project/static/js` directory
135136
and extend the `extra_head` template block:
136137

137138
{% block extra_head %}
138139
{{ block.super }}
139-
<script type="text/javascript" src="{{ MEDIA_URL }}override/js/my_cool_tweaks.js">
140+
<script type="text/javascript" src="{{ MEDIA_URL }}static/js/my_cool_tweaks.js">
140141
{% endblock extra_head %}
141142

142143
### Specific Pages
143144

144-
Since `sample_project/override/templates` is the first entry in `settings.TEMPLATE_DIRS` you
145+
Since `sample_project/templates/codespeed` is the first entry in `settings.TEMPLATE_DIRS` you
145146
may override any template on the site simply by creating a new one with the
146147
same name.
147148

148-
* About page: create `sample_project/override/templates/about.html`:
149+
* About page: create `sample_project/templates/about.html`:
149150

150151
{% extends "codespeed/base_site.html" %}
151152
{% block title %}{{ block.super }}: About this project{% endblock %}

sample_project/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ def process_exception(self, request, exception):
117117

118118
STATIC_URL = '/static/'
119119
STATIC_ROOT = os.path.join(BASEDIR, "sitestatic")
120+
STATICFILES_DIRS = (
121+
os.path.join(BASEDIR, 'static'),
122+
)
120123

121124
# Codespeed settings that can be overwritten here.
122125
from codespeed.settings import *

0 commit comments

Comments
 (0)