Django-admin startproject salom app yaratish python manage py startapp sahifa


Download 13.78 Kb.
Sana09.09.2023
Hajmi13.78 Kb.
#1674722
Bog'liq
django


django-admin startproject salom
app yaratish - python manage.py startapp sahifa
import os
installed_apps ga quyidagi kirtiladi: sahifa

sahifadi viewsga o’tamiz va httm modulini yuklab olamiz.


from django.http import HttpResponse
def HomePageView(request):
return HttpResponse('Kamalova Nilufar')

sahifaning ichiga urls.py ni ochamiz


from django.urls import path
from .views import HomePageView
urlfoydalanuvchi=[
path('',HomePageView,name='home')
]

glavni urlsga qo’shaib qo’yamiz: path('',include('sahifa.urls'))

ishga tushirish python manage.py runserver

HTML shablonlari (templateni ko’rsatish) :


'DIRS': [os.path.join(BASE_DIR,'shablon')],
{% extends 'home.html' %}
{%block contend %}
<h2 style="color:green;"> Biz haqimizdah2>
{% endblock content%}
Download 13.78 Kb.

Do'stlaringiz bilan baham:




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