django serving static css files

强颜欢笑 提交于 2019-12-04 20:49:23

Here's how I usually go about managing dynamic project root:

from os.path import dirname, realpath, join
PROJECT_ROOT = dirname(realpath(__file__))

And then further below, the static root:

STATIC_ROOT = join(PROJECT_ROOT, 'static/')    

And then you reference static files like so:

{{ STATIC_URL }}css/Style.css

EDIT:

See the documentation for more information.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!