如何在 Django 中使用 CSS? [英] How do I use CSS in Django?

查看:42
本文介绍了如何在 Django 中使用 CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Django 创建我的应用程序,想知道如何让 Django 使用我的 CSS 文件?我需要做哪些设置才能让 Django 看到 css 文件?

I am creating my application using Django, and am wondering how I can make Django use my CSS file? What settings do I need to do to make Django see the css file?

注意:在本地机器上

推荐答案

如果您使用的是开发服务器,请遵循 django 项目管理静态文件的操作指南 设置您的 URL,然后在模板中引用您的媒体文件 - 例如,来自 /site_media/images/foo.gif.

If you're using the development server follow the django project's how-to guide for managing static files to setup your URL's, then reference you media files in the template -- say, an image inside an image folder from /site_media/images/foo.gif.

这篇关于如何在 Django 中使用 CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆