Django - Templates: Static files

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 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, add following code:


Step 5: Open index.html, and convert path into: href="/static/css/main.css"
write {% load static %} in the first line, href="{% static 'css/main.css' %}"

Active Links

request.path - returns the page url.

    # {{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>