R
R
rmfalx2017-07-14 09:43:15
Django
rmfalx, 2017-07-14 09:43:15

How to display a specific module on the main page?

Help me please!
The situation is this. There is a blog on django made according to the instructions
I made a file about.html and filled it with:

{% extends 'autist/base.html' %}
{% block header %}
Header
{% endblock %}

Accordingly, I have a base.html file in which
<html>
  <head>
    <title>заголовок</title>
  </head>
  <body>
    {% block header %}{% endblock %}
  </body>
</html>

There is a representation
def page_about(request):
    return render(request, 'autist/about.html');

And also urls.py
url(r'^about', views.page_about, name='page_about'),

But nothing is displayed for me ((( What should I do?
Along the way, I created a separate page. If I add a separate link to about.html in base.html, then I will go to it and the text is displayed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rostislav Grigoriev, 2017-07-14
@crazyzubr

url(r'^$', views.page_about, name='page_about'),
If you need a main page, then of course the name of the view and the url must also be changed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question