Veb-ramka sifatida Django htmlni dinamik ravishda yaratish uchun qulay usulga muhtoj. Eng keng tarqalgan yondashuv shablonlarga tayanadi


Download 1.02 Mb.
Pdf ko'rish
bet9/15
Sana17.01.2023
Hajmi1.02 Mb.
#1097921
1   ...   5   6   7   8   9   10   11   12   ...   15
Bog'liq
1. Umumiy koʻrinish (Overview) (1)

https://t.me/django_docs_uz
'BACKEND'

'django.template.backends.django.DjangoTemplates'

'DIRS'
: [ 
'/home/html/example.com'

'/home/html/default'

], 
}, 

'BACKEND'

'django.template.backends.jinja2.Jinja2'

'DIRS'
: [ 
'/home/html/jinja2'

], 
}, 

Agar siz 
get_template('story_detail.html') 
deb nomlansangiz, Django quyidagi tartibda qidiradi:

/home/html/example.com/story_detail.html

'django' 
dvigatel
(engine)


/home/html/default/story_detail.html

'django' 
dvigatel) 

/home/html/jinja2/story_detail.html

'jinja2'
dvigatel) 
Agar siz 
select_template(['story_253_detail.html', 'story_detail.html']) 
ga qo'ng'iroq qilsangiz, Django 
quyidagilarni qidiradi:

/home/html/example.com/story_253_detail.html

'django'
dvigatel) 

/home/html/default/story_253_detail.html

'django'
dvigatel) 

/home/html/jinja2/story_253_detail.html

'jinja2'
dvigatel) 

/home/html/example.com/story_detail.html

'django'
dvigatel) 

/home/html/default/story_detail.html

'django'
dvigatel) 

/home/html/jinja2/story_detail.html

'jinja2'
dvigatel) 
Django mavjud shablonni topganda, u qidirishni to'xtatadi. 
Maslahat 
Moslashuvchan shablonni yuklash uchun 
select_template() 
dan foydalanishingiz mumkin. Misol uchun, agar siz 
yangilik yozgan bo'lsangiz va ba'zi hikoyalar uchun maxsus andozalar bo'lishini istasangiz, 

Download 1.02 Mb.

Do'stlaringiz bilan baham:
1   ...   5   6   7   8   9   10   11   12   ...   15




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling