Read a lot online about how Django uses local css/js, but it doesn't work.
Today, we finally found a way to use it, record it.
Create a static folder at the same level of manager.py with CSS, JS, image, and other files or folders
My folder hierarchy
Then it's simple, just set it in settings.py and add the following code at the end.
Static_url ='/static/' Here=Os.path.dirname (Os.path.abspath (__file__)) here= Os.path.join (Here,'.. /') Staticfiles_dirs=(# Put strings here, like"/home/html/static"Or"c:/www/django/static". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths.Os.path.join (Here,'static/'),)
In the HTML file that you want to use, import it in the following way
<!--introduce local CSS & js--> <link rel="stylesheet" href=". /static/style/medicine.css" /> <script type="text/javascript" src=". /static/javascript/medicine.js"></script>
Django uses local css/js files