0

I am a noob when it comes to django or any backend related programs. i would like to add the same static files for a path which is not home in my django project.

Here I am in my howe directory and there is no issues with loading static css and js file.home page but if i try to move to another pathother link static file are not loading. how can i load same static files but for different url other than the homepage

I even added another folder named loading in my working dir but am still unsuccessful

  • 1
    Does this answer your question? [How to make static directory in Django](https://stackoverflow.com/questions/71873839/how-to-make-static-directory-in-django) – sahasrara62 Aug 07 '23 at 11:31
  • Please show the code. settings.py, urls.py, template and so on. Take a look at any of similar questions. And/or take a look at django docs https://docs.djangoproject.com/en/4.2/howto/static-files/ – Ivan Starostin Aug 07 '23 at 20:35
  • thank you all for the answers i get around this problem by loading the static files into the template using {% load static%} – Rahul Gupta Aug 10 '23 at 06:30

1 Answers1

0

Django By default takes a static path from app directory, But you can change your custom static path like this...

If you go with the default path then the below setting works fine.

STATIC_URL = '/static/'

If you want to set your custom static path then you need to add the below line.

STATICFILES_DIRS = ['relative path of your static folder']