Django造型问题 [英] Problem with Django styling
问题描述
我的settings.py包含
Hi new to django but I'm having issues with the stylesheets (CSS) of pages.
新的django,但我有问题的样式表(CSS)的页面。
my settings.py contains
MEDIA_ROOT = ''
MEDIA_URL = ''
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'templates'),
)
请帮助我点亮我需要做的是让CSS样式在我的模板中工作
please can someone help me shed some light on what I need to do to get the CSS styles working in my templates
谢谢
推荐答案
模板设置只是为了帮助您在视图处理程序中选择一个模板文件进行渲染。
The templates setting is just for aiding when you're selecting a template file for rendering in your view handler.
如果要提供文件,例如CSS,请参阅如何使用Django提供静态文件 ,这是最简单的方法。然而,最好的方法是将您的服务器配置为CSS(和其他静态文件)请求,自己提供文件,而不是将请求提交给Django处理程序。
If you want to serve files, such as CSS, see how to serve static files with Django, which is the easiest way. The best way, however, is to configure your server to, for the CSS (and other static files) requests, serve the files himself instead of handing the request to the Django handler.
这篇关于Django造型问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!