简体   繁体   中英

How to load static JavaScript file and css in Django with Pycharm

I am new to django , I am unable to set path to load js and css file from directory. When I run server my page is showing without css and js. I setting file of project I have set static path as:

STATIC_URL = '/templates/'

and in template directory I have 3 dir named html, js, css. I am able to load html file from html dir but not js and css.

Create folder, name it static copy CSS , JS to that NOT HTML it should remain in the templates directory and Change the STATIC_URL = '/templates/' to STATIC_URL = '/static/' . This is how Django manages the static files( CSS , JS , IMAGES ).
Check this out for more information https://docs.djangoproject.com/en/2.1/howto/static-files/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM