settings.py --- STATIC_URL = '/static/' STATICFILES_DIRS = [BASE_DIR / 'static',]
root\static\css\style.css
.note-li{
color: red;
}
notes_list.html
----
{% load static %}
<html>
<head>
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}" />
to modulorize:
--------------------
base.html in static\templtates
------
{% load static %}
<html>
<head>
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}" />
as templates in static folder, not in app folder. add entry in settings.py
TEMPLATES=[{'DIRS': [BASE_DIR/'static/templates']}]
for dynamic anchor tag linking,
<a href="{% url 'notes.list' %}">
<a href="{% url 'notes.detail' pk=note.id %}">
//in urls.py
path('notes',views.NotesListView.as_view(),name="notes.list")
No comments:
Post a Comment