5. Link template - Aklinahs/Django-beginner GitHub Wiki

Now the basic template reconfiguration is done, lets link this html template to our website.

Home template

image

Now go to the views.py and add following code

image

then open the base\urls.py and add the followings

image

save the files and run the virtual server. then go to the http://127.0.0.1:8000 and you will see a page like this

image

the page seems still ugly, we have to make several changes.

first we have to configure the style file.

move the style.css file to sudybud/base/static/styles folder

now to add this styles to the template, open studybud/templates/main.html and edit the stylesheet path to href="{% static 'styles/style.css' %}"

then add {% load static %} before the html tag like this

image

room template

at the top of the html code, remove the header section until the main tag, and add following codes. it will looks like this

{% extends 'main.html' %}

{% block content %}

image

now at the bottom of the html code, remove closing body and html tags and add the following code

{% endblock %}

image

go to the base/views.py and make new class for rooms

image

now go the base/urls.py and add following

image

profile template

at the top of the html code, remove the header section until the main tag, and add following codes. it will looks like this

{% extends 'main.html' %}

{% block content %}

image

now at the bottom of the html code, remove closing body and html tags and add the following code

{% endblock %}

image

go to the base/views.py and make new class for rooms

image

now go the base/urls.py and add following

image

all the other templates

do the same

at the end base/views.py will look likes this

image

base/urls.py will looks like this

image

Now we have to configure all the functionalities of these templates,