Django Cheatsheet Loading... What is Django? Python-based web framework used for rapid development. Installing Django + Setup pip install django Copy Creating a project The below command creates a new project django - admin startproject projectName Copy Starting a server The below command starts the development server. python manage . py runserver Copy Django MVT Django follows MVT(Model, View, Template) architecture. Sample Django Model The model represents the schema of the database. from django . db import models class Product ( models . Model ) : // Product is the name of our model product_id = models . AutoField Copy Sample views.py View decides what data gets delivered to the template. from django . http import HttpResponse def index ( request ) : return HttpResponse ( '' Django CodeWithHarry Cheatsheet '' ) Copy Sample HTML Template A sample .html file that contains HTML, CSS and Javascript. < !DOCTYPE html > < html lang = "en"
Join our blog for information about latest technology and IT.