django documentation, serving static files, 3 simple steps? Nope
https://docs.djangoproject.com/en/1.3/howto/static-files/
Trying to serve static files i was put on to the above link.
The link tells me when serving static files in development
- Put your static files where they will be found, 'home/jamie/mysite/static/' Done!
2.Make sure that django.contrib.staticfi开发者_运维问答les is included in your INSTALLED_APPS. For local development, if you are using runserver...you’re done with the setup. Done!
3.You’ll probably need to refer to these files in your templates. The easiest method is to use the included context processor which allows template code like:
<img src="{{ STATIC_URL }}images/hi.jpg" />
Done!
Wow, that seems too simple, surely it wouldn't work, and sadly, no.
{{ STATIC_URL }} when i checked, equals None. Now STATIC_URL by default is none, therefore these instruction haven't done a thing. Surely i've done something wrong and the django documentation is right. But i cant figure out where in the three simple steps i've gone wrong.
Try setting STATIC_URL = '/static/'
in your settings.py
.
精彩评论