S
S
Sergey Karbivnichy2020-06-18 21:07:43
Flask
Sergey Karbivnichy, 2020-06-18 21:07:43

Flask - working with templates?

I can't figure out how to work with templates. Sketched one pattern. It has a website header (there is a menu and a search bar). And here I ran into a problem. It is necessary that the first template is loaded on the main page, the second template is loaded on the results page. When following a link from a search results page - the third template. But the top should be the same.
At first I thought to transfer html to the main template, which I will generate depending on the url. But then there will be a lot of html in the py code. Or do they do it?
PS: Or is it possible to somehow include, for example, one template in another?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2020-06-18
@dimonchik2013

https://habr.com/ru/post/193260/
see inheritance
and
https://flask-russian-docs.readthedocs.io/ru/lates...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question