python - Can't load .css and image files in django -


i can't load images , css files in django, although seems fine in settings.py , in home.html file itself... can problem here?

in static folder there template, css , image folders.

html:

{% load staticfiles %} <link rel="stylesheet" type="text/css" href="{% static 'css/main.css' %}"> <title>main page</title> 

settings.py:

    # static files (css, javascript, images) media_root = os.path.join(base_dir, "/media") #media_url = '' #static_root = os.path.join(base_dir, "static")  staticfiles_dirs = [     os.path.join(base_dir, "/static") ] static_url = "/static/" 

unfortunately, looks this: web page in russian no css formatting , broken images

django.contrib.staticfiles not included in installed_apps.

your settings.py should (in installed apps)

installed_apps = [     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.sites',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.messages',     'django.contrib.staticfiles', ] 

without static files won't work if else setup because django it's not installed though (technically).


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -