How to use external static files with Django (serving external files once again)?
- by Tomas Novotny
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