We have to specify the location of our static files folder. This is around line 66. Don’t forget the comma following the quoted folder path; it looks odd, but it’s actually required.
STATICFILES_DIRS = (
"/home/liucs/cs690/bookswap/static",
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
Now you can create the static
folder in the top-level bookswap
. Any file you save there, such as images, stylesheets (CSS), scripts (JavaScript) will be accessible to your web site using a URL prefixed with /static/
. So, if you drop logo.png
into the static
folder, you can then include it on your site with this HTML:
<img src="/static/logo.png">