Django: how do you serve media / stylesheets and link to them within templates

后端 未结 7 1670
心在旅途
心在旅途 2020-12-07 09:47

Variations of this question have been asked, but I\'m still unable to get my stylesheets to load correctly when my templates are rendered.

I\'m attempting to serve s

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-07 10:00

    I've got a couple of ideas, I don't know which one of them is working for me :)

    Make sure to use a trailing slash, and to have this be different from the MEDIA_URL setting (since the same URL cannot be mapped onto two different sets of files).

    That's from http://docs.djangoproject.com/en/dev/ref/settings/#admin-media-prefix

    Secondly, it may be that you're confusing directories on your filesystem with url paths. Try using absolute urls, and then refine them down.

提交回复
热议问题