浏览代码

fix fontawesome icons not showing up via static

Mohammed Khan 1 年之前
父节点
当前提交
52538768a5
共有 2 个文件被更改,包括 8 次插入5 次删除
  1. 5 2
      backend/UnTube/settings/base.py
  2. 3 3
      backend/templates/base.html

+ 5 - 2
backend/UnTube/settings/base.py

@@ -119,10 +119,13 @@ USE_TZ = True
 # Static files (CSS, JavaScript, Images)
 # https://docs.djangoproject.com/en/3.2/howto/static-files/
 STATIC_URL = '/static/'
-STATIC_ROOT = BASE_DIR / 'staticfiles'  # type: ignore
+STATIC_ROOT = BASE_DIR / 'static'  # type: ignore
 # STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
+# STATICFILES_DIRS = (
+#     BASE_DIR / 'backend' / 'main',  # type: ignore
+# )
 STATICFILES_DIRS = (
-    BASE_DIR / 'backend' / 'main',  # type: ignore
+    os.path.join(BASE_DIR, 'backend', 'main', 'static'),  # type: ignore
 )
 
 # Default primary key field type

+ 3 - 3
backend/templates/base.html

@@ -116,10 +116,10 @@
 
          <link rel="preconnect" href="https://fonts.googleapis.com">
         <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link href="https://fonts.googleapis.com/css2?family=Comfortaa&family=Fredoka+One&display=swap" rel="stylesheet">
+     <link href="https://fonts.googleapis.com/css2?family=Comfortaa&family=Fredoka+One&display=swap" rel="stylesheet">
 
-{#        <link href="{% static 'fontawesome-free-5.15.3-web/css/all.min.css' %}" rel="stylesheet">#}
-        <script src="https://kit.fontawesome.com/5baac7e9b7.js" crossorigin="anonymous"></script>
+        <script src="{% static 'fontawesome-free-5.15.3-web/js/all.min.js' %}" type="application/javascript"></script>
+        {#        <script src="https://kit.fontawesome.com/5baac7e9b7.js" crossorigin="anonymous"></script>#}
         <link href="{% static 'bootstrap5.0.1/css/bootstrap.min.css' %}" rel="stylesheet">
         <link rel="stylesheet" href="{% static 'choices.js/choices.min.css' %}">