Intro to Django

markkimjr·2021년 1월 21일
0
post-thumbnail

What is a web framework?

As the word "framework" indicates, a web framework is sort of like a loose skeleton that has already been built for us. As long as we follow the rules of the framework, we can use it to build our own website, or in the case of the skeleton, a human body 😱. To provide a more technical definition, a web framework is a collection of packages or modules (code library) that makes web development MUCH easier by providing a common framework for us to build around. So long as we follow the rules of the framework, we are in good shape!

MVC (Model View Controller)


Basic pattern that is used to make web programs

Model (models.py): store data safely, query data (everything is saved on database server)
View (views.py): the basic logic of the program. Use views.py determine how to show data to user in proper and optimal way (how data and interface are presented)
Controller/Template (template.py): Update and coordinate Model and View according to user inputs and events (html files)

Django acts as the Controller (template) and is thus a web framework that we can use to build programs!

Django - Basic Concepts

**manage.py **is used to run and control different features of the program, and settings.py is used to control the settings and options of the project.

manage.py import terms:

  • startapp (create app)
  • runserver (run server)
  • createsuperuser (create admin)
  • makemigrations app
  • migrate: reflect changes on database
python manage.py sqlmigrate account 0001
  • shell
  • collectstatic

References: https://www.essenceandartifact.com/2012/12/the-essence-of-mvc.html

profile
#mambamentality 🐍

0개의 댓글