Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use CSS in Django?

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?

NB: On a local machine

like image 848
gath Avatar asked Nov 04 '08 08:11

gath


People also ask

Where do CSS files go in Django?

css . In other words, your stylesheet should be at polls/static/polls/style. css . Because of how the AppDirectoriesFinder staticfile finder works, you can refer to this static file in Django as polls/style.

Which CSS framework is best for Django?

Use either Materialize CSS or Bulma for your Django project to make it look nice without much hassle.

How do you use CSS in Python?

CSS learning checklist Create a simple HTML file with basic elements in it. Use the python -m SimpleHTTPServer command to serve it up. Create a <style></style> element within the <head> section in the HTML markup. Play with CSS within that style element to change the look and feel of the page.


1 Answers

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.

like image 194
Joe Avatar answered Oct 08 '22 09:10

Joe