base.html file This is where jinja is used and all js is linked, i have created a partial file of navigation and footer and the problem is in navigation part
{% load static %}
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Home</title>
<!-- Favicon-->
<link rel="icon" type="image/x-icon" href="{% static 'assets/img/favicon.ico'%}" />
<!-- Font Awesome icons (free version)-->
<script src="https://use.fontawesome.com/releases/v5.13.0/js/all.js" crossorigin="anonymous"></script>
<!-- Google fonts-->
<link href="{% static 'https://fonts.googleapis.com/css?family=Merriweather+Sans:400,700'%}" rel="stylesheet" />
<link href="{% static 'https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic'%}" rel="stylesheet" type="text/css" />
<!-- Third party plugin CSS-->
<link href="{% static 'https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css'%}" rel="stylesheet" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="{% static 'css/styles.css'%}" rel="stylesheet" />
</head>
<body id="page-top">
<!-- Navigation-->
{% include 'partials/_navigation.html' %}
<!-- Navigation-->
<!--content-->
{% block content %}
{% endblock %}
<!--content-->
<!-- Footer-->
{% include 'partials/_footer.html' %}
<!-- Footer-->
<!-- Bootstrap core JS-->
<script src="{% static 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js'%}"></script>
<script src="{% static 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.bundle.min.js'%}"></script>
<!-- Third party plugin JS-->
<script src="{% static 'https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js'%}"></script>
<script src="{% static 'https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js'%}"></script>
<!-- Core theme JS-->
<script src="{% static 'js/scripts.js'%}"></script>
</body>
</html>
Settings: This is the settings part giving static a path
STATIC_URL = '/static/'
#Manually Done
STATICFILES_LOCATION = 'static'
STATIC_URL='/static/'
STATIC_ROOT= os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'MyProject/static')
]
When you have the url to the js file, you don't need jinja.
Instead of:
<script src="{% static 'https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js'%}"></script>
Use:
<script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js"></script>
etc...
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.