feat: add local static files and update references
- Add local Bootstrap CSS and JS files to the static directory. - Add local jQuery file to the static directory. - Update HTML templates to reference local static files instead of CDN links. - Load Django static files in the base template. - Add STATIC_ROOT to Django settings for static file collection. These changes improve website performance and reliability by serving static assets locally, avoiding dependence on external CDNs. Additionally, this facilitates easier offline development and deployment.
This commit is contained in:
parent
431879aea8
commit
e7a7766351
6 changed files with 28 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,3 +7,4 @@ static/js/*
|
|||
media/
|
||||
.venv/
|
||||
venv/
|
||||
/static/
|
7
freedoi/resolver/static/dist/css/bootstrap.min.css
vendored
Normal file
7
freedoi/resolver/static/dist/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
7
freedoi/resolver/static/dist/js/bootstrap.min.js
vendored
Normal file
7
freedoi/resolver/static/dist/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
freedoi/resolver/static/dist/js/jquery-3.5.1.min.js
vendored
Normal file
2
freedoi/resolver/static/dist/js/jquery-3.5.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,13 +1,15 @@
|
|||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>
|
||||
{% block title %}FreeDOI{% endblock title %}
|
||||
{% block title %}
|
||||
FreeDOI
|
||||
{% endblock title %}
|
||||
</title>
|
||||
<link rel="stylesheet"
|
||||
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="{% static "dist/css/bootstrap.min.css" %}" />
|
||||
<style>
|
||||
body {
|
||||
padding-top: 56px;
|
||||
|
@ -55,10 +57,10 @@
|
|||
</div>
|
||||
</nav>
|
||||
<div class="container">
|
||||
{% block content %}{% endblock content %}
|
||||
{% block content %}
|
||||
{% endblock content %}
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
||||
<script src="{% static "dist/js/jquery-3.5.1.min.js" %}"></script>
|
||||
<script src="{% static "dist/js/bootstrap.min.js" %}"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -146,6 +146,7 @@ USE_TZ = True
|
|||
# https://docs.djangoproject.com/en/5.0/howto/static-files/
|
||||
|
||||
STATIC_URL = "static/"
|
||||
STATIC_ROOT = "static"
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
|
||||
|
|
Loading…
Reference in a new issue