简体   繁体   中英

Problem with Django styling

Hi new to django but I'm having issues with the stylesheets (CSS) of pages.

my settings.py contains

MEDIA_ROOT = ''
MEDIA_URL = ''
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'templates'),
)

please can someone help me shed some light on what I need to do to get the CSS styles working in my templates

Thanks

The templates setting is just for aiding when you're selecting a template file for rendering in your view handler.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM