Reading-Notes

View the Project on GitHub MohammadAl-khatib/Reading-Notes

Intro to Django

What is Django?

Django is an open source Python web framework, Django softwares are:

  1. Complete
  2. Versatile
  3. Secure
  4. Scalable
  5. Maintainable
  6. Portable

Common Terminology

Models:

A model is the single, definitive source of information about your data, models are basicly subclasses of django.db.models.Model, when defining a model, each attribute will represent a column in a table, keep in mind that you have to add the model to the installed_apps inside the settings file in order to start using that model.

URLs and views:

A view is the rendered result of requesting a URL, once a request is made, Django will look to a match in the list of urlpatterns and return the associated view, think of the urls as the endpoints and the view as the response.

Templates:

Templates are HTML files that contains some dynamic values that can be called or changed using Python syntax.

Forms:

The well known HTML elements, a form can be generated easily using Django by importing forms, which serves as a shortcut for creating and handling forms.

Authentication:

It is a common practice to give full or custom access to authorized peaople only, In Django this is done using the @login_required decorator.

Admins:

Admins can have access to their special features like editing content using from django.contrib import admin.

Internationalization:

Trnsalting the content reletive to the users language.

Resources:

https://www.djangoproject.com/start/

https://wsvincent.com/how-django-works-behind-the-scenes/