Django templates and dictionary-3

 


13.Go to web settings.py
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['templates'],
        ar moddhe aivabe templates likhe dau

14,templates name e folder banau app er moddhe /tar moddhe app er same name  e folder banau
  /tar moddhe html file banau


15.views.py a aibar function likhba aivabe
 def index(request):
     return render(request,"firsr_app/index.html")

16.Jodi dictionary value html page e pathate chaw tahole function likhba aivabe
   def index(request):
    my_dict={'insert_me':'Hallow I am views.py'}
    return render(request,"firsr_app/index.html",my_dict)

17.aikhan theke pathano dictionary value html page thake access korba:
  {{insert_me}} aivabe
  mane {{...}}ar moddhe dictionary key diye

Comments

Popular posts from this blog

D WEB LINK