How to use external static files with Django (serving external files once again)?
Posted
by
Tomas Novotny
on Stack Overflow
See other posts from Stack Overflow
or by Tomas Novotny
Published on 2011-01-08T16:30:43Z
Indexed on
2011/01/08
16:53 UTC
Read the original article
Hit count: 172
Hi, even after Googling and reading all relevant posts at StackOverflow, I still can't get static files working in my Django application.
Here is how my files look:
settings.py
MEDIA_ROOT = os.path.join(SITE_ROOT, 'static')
MEDIA_URL = '/static/'
urs.py
from DjangoBandCreatorSite.settings import DEBUG
if DEBUG:
urlpatterns += patterns('', (
r'^static/(?P<path>.*)$',
'django.views.static.serve',
{'document_root': 'static'}
))
template:
<script type="text/javascript" src="/static/jquery.js"></script>
<script type="text/javascript">
I am trying to use jquery.js stored in directory "static".
I am using: Windows XP Python 2.6.4 Django 1.2.3
Thank you very much for any help
© Stack Overflow or respective owner