0

I project a folder name = portfolio_projects in which I created the app

enter image description here

Here is where my static folder and app is present:

enter image description here

code of my settings.py

STATIC_URL = '/static/'
STATICFILES_URL=[
    os.path.join(BASE_DIR, 'static'),
]

and here is the file in which I want to import

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

here is the screenshot from the editor with marking

enter image description here

i am getting this error enter image description here

Barbora
  • 921
  • 1
  • 6
  • 11
  • for any more information please comment i will definitely reply you. –  Apr 25 '21 at 11:16
  • Does this answer your question? [django html template can't find static css and js files](https://stackoverflow.com/questions/66437690/django-html-template-cant-find-static-css-and-js-files) – Ivan Starostin Apr 25 '21 at 16:15

1 Answers1

1

That STATICFILES_URL should be STATICFILES_DIRS in settings.py.

Also, clear your browser cache or in Google Chrome you can do a hard refresh by pressing Ctrl + Shift + R.

  • sir treid it but it was not working even I restarted the server –  Apr 25 '21 at 11:21
  • Also, move the static folder inside your app directory and {% load static %} at the top of the base.html – Anurag Srivastava Apr 25 '21 at 11:27
  • Thanks a lot sir. it woked Thanks lot. I had checked all my mistakes even i copied the and replaced some part of this from older project but i don' t that there is URL at place of DIRS –  Apr 25 '21 at 11:28