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
Now go to the views.py and add following code
then open the base\urls.py and add the followings
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
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
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 %}
now at the bottom of the html code, remove closing body and html tags and add the following code
{% endblock %}
go to the base/views.py and make new class for rooms
now go the base/urls.py and add following
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 %}
now at the bottom of the html code, remove closing body and html tags and add the following code
{% endblock %}
go to the base/views.py and make new class for rooms
now go the base/urls.py and add following
all the other templates
do the same
at the end base/views.py will look likes this
base/urls.py will looks like this
Now we have to configure all the functionalities of these templates,