Django

Due Date

Introduction

So After AJAX, we are left with Web Backend to gain a good command over web dev. That is why we bring you here, to Django!

Django is a Loosely Coupled Framework, that uses MVC (Model-View-Controller) core architecture. What is MVC, well that's not important for now.

Here is a brief intro to why we use Django:

Why We Use Django Framework & What Is Django Best Used For
Choosing a web development framework is a big deal. There are quite a few frameworks on the market, each designed to address different project needs. For many companies and independent projects, the Django framework is an easy choice - it's one of the most popular web development tools. But why is that?
https://djangostars.com/blog/why-we-use-django-framework/

Check out the official site:

Django
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It's free and open source.
https://www.djangoproject.com/
💡
Django likes to call itself "The Web Framework for Perfectionists with Deadlines". Hopefully you'll be able to validate the authenticity of their claim by the end of next week! 😉

Why was Django made?

The backend developers needed a common interface to be able to work with seemingly different data sources and database software.

The design teams needed to manage the user experience with the tools they already had (HTML, CSS, JavaScript etc.)

The hard-core coders needed a framework that allowed them to rapidly deploy changes within the system that kept everyone happy.

Features

Django has

Principles

Design philosophies | Django documentation | Django
A fundamental goal of Django's stack is loose coupling and tight cohesion. The various layers of the framework shouldn't "know" about each other unless absolutely necessary. For example, the template system knows nothing about Web requests, the database layer knows nothing about data display and the view system doesn't care which template system a programmer uses.
https://docs.djangoproject.com/en/3.0/misc/design-philosophies/#don-t-repeat-yourself-dry

Most important principles to remember:

  1. DRY aka Don't Repeat Yourself
  1. Loose Coupling
  1. Explicit is better than implicit
  1. EAFP aka Easier to Ask Forgiveness than Permission (read more)
  1. Efficient SQL Queries
💡
Don't worry, if you do not understand all of the above principles right now. You'll understand and appreciate them as you work more with the framework.

Resources

MVC (Model-View-Controller) core architecture

Understanding the MVC pattern in Django
In my previous post, i put up a tutorial for beginners on how to get started with Django, here.
https://medium.com/shecodeafrica/understanding-the-mvc-pattern-in-django-edda05b9f43f

Basic

Here is a complete tutorial in Django

Django Web Framework (Python)
Django is an extremely popular and fully featured server-side web framework, written in Python. This module shows you why Django is one of the most popular web server frameworks, how to set up a development environment, and how to start using it to create your own web applications.
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django

Alternatively, another popular Django learning site is Django Girls.

Django Girls Tutorial
This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit https://creativecommons.org/licenses/by-sa/4.0/ Welcome to the Django Girls Tutorial!
https://tutorial.djangogirls.org/en/

With so much serious content, you could also do well with something less technical. Here you go!

A Complete Beginner's Guide to Django - Part 1
Introduction Today I'm starting a new tutorial series about Django fundamentals. It's a complete beginner's guide to start learning Django. The material is divided into seven parts. We're going to explore all the basic concepts in great detail, from installation, preparation of the development environment, models, views, templates, URLs to more advanced topics such as migrations, testing, and deployment.
https://simpleisbetterthancomplex.com/series/2017/09/04/a-complete-beginners-guide-to-django-part-1.html

Being just introduced to Django, it would be of help to get tips from time tested users of Django.

Article Archive - Simple is Better Than Complex
This is a blog about Python, Django and Web Development. New posts every week.
https://simpleisbetterthancomplex.com/archive/

User Authentication System

Creating a backend without user login and authentication is incomplete. A user authentication system makes the app personalised for users. It takes the web app to altogether another level. Django has a built in authentication system,getting your work done with almost no effort, giving you most of the joy.

Here you can learn more about it:

Django Login and Logout Tutorial | LearnDjango
How to implement login and logout in Django 3.0 In this tutorial we'll learn how to configure login/logout functionality with Django's the built-in user authentication system. This is the first in a three-part series that also covers signup and password reset for a complete user authentication flow in your future Django projects.
https://learndjango.com/tutorials/django-login-and-logout-tutorial

For Custom Login UI, try out this:

https://www.fir3net.com/Web-Development/Django/django.html

Challenge and Submission

So much for learning, here is your next Assignment!

All the details of the task are provided in the README.md file.

As you are aware, you need to fork from and the repository, clone the forked repository, complete the task, commit and push your changes and finally open the pull request back here.

COPS-IITBHU/csoc-2020-task-2
Welcome to the Week 2 of CSOC Dev. In this assignment, you will be working on the Django backend of a library web application. A boilerplate has already been created for you and all that remains is to fill in the code wherever we've asked you to, or wherever you feel required.
https://github.com/COPS-IITBHU/csoc-2020-task-2