Maciejjy
Maciejjy

Reputation: 147

Can't load CSS to my django local website

I am running through django tutorial on book "Try Django". Everything was ok until CSS chapter. I have created basic site and now I want to change some colors but I am unable to do it.

Django 1.10. I have created directory in my app 'static' and inside is file 'style.css' with some basic instruction to change color of h1 text.

Inside settings.py I have: 'django.contrib.staticfiles' and my app installed, Debug is True, STATIC_URL = '/static/'

html of site: http://pastebin.com/PBhZieRe

Unfortunately h1 text is still black. I tried to read through documentation on https://docs.djangoproject.com/en/1.10/howto/static-files/ but everything looks ok there. When I simply type url 127.0.0.1:8000/static/style.css in my command line I get 304 code.

Need some advice on that.

Regards.

Upvotes: 2

Views: 531

Answers (1)

Prateek Gupta
Prateek Gupta

Reputation: 2800

It seems you have forgot to mention path for your static folder in the settings.py file.What you have to do is just put a line :

STATIC_ROOT=os.path.join(BASE_DIR,'static')

in your settings.py file and then your static files will load.

Upvotes: 0

Related Questions