Using font-awesome in python django application

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Using font-awesome in python django application



I'm trying to load a local copy of font awesome icons in my python django app.



My template base.html contains:


{% load static %}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="{% static 'appointments/css/all.css' %}" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
<title>{% block title %}Hello, world!{% endblock %}</title>
</head>



as adapted from https://docs.djangoproject.com/en/2.0/howto/static-files/



The directory structure of my app is:


joel@hp:~/myappointments$ tree
.
├── appointments
│   ├── admin.py
│   ├── apps.py
│   ├── __init__.py
│   ├── migrations
│   │   ├── __init__.py
│   ├── models.py
│   ├── static
│   │   └── appointments
│   │   ├── css
│   │   │   ├── all.css
│   │   └── webfonts
│   │   ├── fa-brands-400.eot
│   │   ├── fa-brands-400.svg
│   │   ├── fa-brands-400.ttf
│   │   ├── fa-brands-400.woff
│   │   ├── fa-brands-400.woff2
│   │   ├── fa-regular-400.eot
│   │   ├── fa-regular-400.svg
│   │   ├── fa-regular-400.ttf
│   │   ├── fa-regular-400.woff
│   │   ├── fa-regular-400.woff2
│   │   ├── fa-solid-900.eot
│   │   ├── fa-solid-900.svg
│   │   ├── fa-solid-900.ttf
│   │   ├── fa-solid-900.woff
│   │   └── fa-solid-900.woff2
│   ├── templates
│   │   └── appointments
│   │   ├── base.html
│   │   ├── createappointment.html
│   │   ├── doctor.html
│   │   ├── doctors.html
│   │   ├── home.html
│   │   ├── index.html
│   │   ├── navbar.html
│   │   ├── patient.html
│   │   └── patients.html
│   ├── tests.py
│   ├── urls.py
│   ├── using shell.txt
│   └── views.py
├── appointments.ipynb
├── db.sqlite3
├── manage.py
├── myappointments
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py



However these icons are not being served. It works if I use the following:


<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">





do you have all fonts file inside webfonts folder i.e .ttf, .woff, .eot etc
– Satendra
7 mins ago




webfonts


.ttf


.woff


.eot





Yes I do. I didnt include them in the tree for brevity.
– Droidzone
6 mins ago





use single quote while using static tag i.e href="{% static '/appointments/css/all.css/' %}"
– Satendra
4 mins ago


href="{% static '/appointments/css/all.css/' %}"





Tried that too.. Edited post to what I tried with single quotes
– Droidzone
1 min ago









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

VsWjONv00w7,8lBCfC
RIHLdojeAexLd vL7Nf8L0,eaf,HiRmAZkizkhEhEDCGd4KRCnLlDWnvbwBCB88

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham