Convert a HTML template into Django project.
Step 1: Copy all HTML files and past into Django templates folder
Step 2: Create a folder, where a manage.py is located and name it as static.
Step 3: Copy all CSS, JS, Images folder of your HTML template and paste into Django Static folder.
Step 4: In Settings.py, add following code:
STATICFILES_DIRS=[ BASE_DIR,"static" ]
Step 5: Open index.html, and convert path into: href="/static/css/main.css"
or
write {% load static %} in the first line, href="{% static 'css/main.css' %}"
request.path - returns the page url.
<ul> # {{request.path}} - display path. <li class="{% if request.path == '/' %} active {% endif %}"><a href="home">Home</a></li> <li class="{% if request.path == '/about' %} active {% endif %}"><a href="about">About</a></li> {% url 'contact' as con %} <li class="{% if request.path == con %} active {% endif %}"><a href="{{con}}">Contact</a></li> </ul>