Wednesday, June 26, 2013

Static pages, images and styles using Django

1. Step: Create the directory static inside of the application directory (<app_dir>/static)
    eg: mysite/polls/static

2. Step: Create one directory using the name of app inside of static directory (<app_dir>/static/<app_name> )
     eg:  mysite/polls/static/pools

3. Step: Put the content into the static directory

4. Step: Include  the command below into the HTML file
{% load staticfiles %}
e.g.:
{% load staticfiles %}

<link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}" />



No comments:

Post a Comment