1) Django -> web application framework
2) uses MVT approach -> model, view, template
3) model-> data used from the database. It use ORM approach(object relational
mapping). Uses python classes and object to fetch the data from db(models.py)
4) view->request handler that returns relevant template and content. It is function or
method that takes http request as argument, import the relevant model and find out
what data need to sent to template.(views.py)
5) template -> it is text file (html file) that defines the layout.(templates.py)
6) URL’s -> Django also allows to move to different pages. When user requests url,
Django decide which view need to be sent.(urls.py)
Intall Django:
1) Pip3 install Django
2) django-admin --version
create virtual Env: (to solve different packages and models versioning issue):
1) python -m vent virtualEnvName
Start new project:
1) django-admin startproject project_name
Run server:
1) go to project folder which was created
2) python manage.py runserver
3) if migration error, then python manage.py migrate
4) if port error, then runserver in new port or kill the process which is running.
(python manage.py runserver 8001) for new port