Django Freymvorkida Test Yechuvchi Websayt Ya’ni Quizz App Yasaymiz
Python dastur tilida yozilgan Django freymvorkining yordamida quizz app yasashni o’rganamiz.
Step 1: Django Loyihasi Ochildi
Django loyihasini ochildikdan so’ng, quizz app uchun yangi bir app yarating:
python manage.py startapp quizzes
Step 2: Modelsni Yaratish
Quizz app uchun modelsni yaratish:
from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
Step 3: Admin Panelga Modelni qo’shish
Admin panelga modelni qo’shish uchun admin.py fayliga quyidagi kodni qo’shing:
from django.contrib import admin
from .models import Question
admin.site.register(Question)
Step 4: URLsni Yaratish
Quizzes app uchun urls.py faylini yaratish:
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]
Step 5: Viewsni Yaratish
Quizzes app uchun views.py faylini yaratish:
from django.shortcuts import render
def index(request):
return render(request, 'quizzes/index.html')
Step 6: Templatesni Yaratish
Quizz app uchun templates papkasida index.html faylini yaratish:
<html>
<head>
<title>Quizzes App</title>
</head>
<body>
<h1>Welcome to Quizzes App!</h1>
</body>
</html>
Step 7: Serverni Boshlash
Quizz appni serverda boshlash uchun quizz app nomi bilan serverni ishga tushirish:
python manage.py runserver
omadizi bersin, ko'pro loyihala qiling, o'zbek tilida hali hech kim proekt qilmagan
alloh rozi bulsin brat
Videoni qaysi dasturda yozasiz?
Bro frontend kodlarni yo githubga joylamapsiz yoki videoda korsatmapsiz
Assalomu alaykum localhostda huddi shu test dasturi javoblari bitta adminga junatiladigan qilsa bo'ladimi. Yani bitta kampyuterdan runserver qilib turib o'quvchilar ishlagan testlarini server kampyuterda dashboardda ko'rinadigan qilsa bo'adimi.
Darslaringiz zo'r hammasini qoldirmay kuzatib boraman. Siz bilan bog'lanishni iloji bormi?
Assalomu alaykum aka bu praektni frontend shablonini qayerdan olsakbo'ladi agar bo'lsa tashab qo'ying aka
thanks a lot friend…
Assalamu alaykum Akbarjon hali ham chiqarmadzku DRf da
👏👏👏
Assalamu alaykum yaxshimisz Abbarjon shuni Drf da ham qilib korsating iloji bolsa
Raxmat katta. Alloh o'zi rozi bo'sin. Herokuga depoy qilishni ham o'rgatinng
E gap yog`e . Zor qilib siz. Deploy ha qiling zor loyiha bolibdi 🙂
3:26 😁
👍👍👍
👍👏👏
🔥🔥🔥🔥🔥