Home>

Faced a problem when I made a site for travel agency. Django does not see the files located in the Static folder. I can not understand what the problem is. I hope to help.

settings.py

static_url= '/static /'
Staticfiles_dirs= (
os.path.join (Base_Dir, "Static"),
'/Backerd /function /static /',

)

index.html:

{% load static%} `
≪
Link REL= "STYLESHEET" TYPE= "TEXT /CSS" HREF= "{% static 'css /normalize.css'%}" >
≪
Link Rel= "StyleSheet" Type= "text /css" href= "{% static 'css /componynts.css'%}" >
≪
Link REL= "STYLESHEET" TYPE= "TEXT /CSS" HREF= "{% static 'css /main.css'%}" >
≪
Link REL= "STYLESHEET" TYPE= "TEXT /CSS" HREF= "{% static 'css /header-page.css'%}" >
≪
Link REL= "STYLESHEET" TYPE= "TEXT /CSS" HREF= "{% static 'css /section-top.css'%}" >
≪
Link REL= "STYLESHEET" TYPE= "TEXT /CSS" href= "{% static 'css /section-about.css'%}" >
≪
Link REL= "STYLESHEET" TYPE= "TEXT /CSS" HREF= "{% static 'CSS /SECTION-Contacts.css'%}" >
≪
Link REL= "STYLESHEET" TYPE= "TEXT /CSS" HREF= "{% static 'CSS /Footer-Page.css'%}" >
≪
Link REL= "Stylesheet" Type= "text /css" href= "{% static 'css /popup.css'%}" >
≪
Link REL= "STYESHEET" TYPE= "TEXT /CSS" HREF= "{% static 'style.css'%}" >
≪
Link REL= "STYESHEET" TYPE= "TEXT /CSS" HREF= "{% static 'animate.min.css'%}" >
≪
Link REL= "STYLESHEET" TYPE= "TEXT /CSS" HREF= "{% static 'css /center.css'%}" >
≪
img class= "logo__img" src= "{% static 'img /common /logo.png'%}" alt= "" width= "127" height= "21" >
≪
img src= "{% static 'img \ common \ tour.jpg'%}" >
≪
img src= "{% static 'img /section-about /bg.jpg'%}" alt= "" class= "section-about__img" >
≪
script src= "{% static 'js /mylib.js'%}" >
≪
/script >
≪
script src= "{% static 'js /header.js'%}" >
≪
/script >
≪
script src= "{% static 'js /popup.js'%}" >
≪
/script >
≪
script src= "{% static 'js /scrollto.js'%}" >
≪
/script >

urls.py

from django.contrib import admin
From Django.urls Import Path, Include
From Something.views Import *
From Django.conf Import Settings
From django.conf.urls.Static Import Static
urlpatterns= [
    Path ('Form /', Include ('form.urls'))
    PATH ('Admin /', admin.site.urls),
]
If settings.debug:
   urlpatterns += static (settings.static_url, document_root= settings.static_root)

Did you make manage.py collectstatic?

JopaBoga2021-04-05 21:31:10