Django for Web Development🐍

Curated By

Avatar of irenekurien Avatar of gladson-lalu

Django is a Python-based free and open-source web framework that follows the model–template–views architectural pattern.

Why learn Django ❓

Django is a popular web framework built on top of python. It helps programmers rapidly create maintainable and flexiable web applications powered by an SQL Database. Django 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 is free and open source, has a thriving and active community, great documentation, and many options for free and paid-for support.

Install and setup stuffs 🚧

Things you need and need not.

  1. A 🖥️ with any OS ✔️

  2. A good light weight editor: VSCode, Atom, Sublime text ✔️

  3. Using super light Notepad Text Editor ❌

  4. Basic programming knowledge in Python ✔️

    Familiarity with the basics of python OOP

  5. Basic Web development knowledge ✔️

  6. Basic knowledge of using a terminal/command line ✔️

    You should know how to install software packages on computer’s operating system.

Installing system-wide or in a Python virtual environment? 🤔

If you install Django into the global environment then you will only be able to one version of Django on the computer. And if you want to create websites using the latest version of Django while still maintaining websites that rely on older versions, then you’ll have a problem here.

Thus, it is better to run apps within independent Python virtual environments which enables multiple different Django environments on a single computer.

Install Python 🌟

Being a Python Web framework, Django requires Python. What version of Python should be used? 😯 The python version supported by the your target django release can be used.

Install Django 🌟

There are three ways to download Django:

  1. Installing an official release with pip.

    This is the best way to get the latest stable version of Django.

  2. Use a version from your computer’s package manager.

  3. Installing the development version.

Head over to the Django documentation and install django into your system/virtual environment.

Building Web Apps using Django 💥

Django provides us with an amazing documentation which makes it easy for anyone new to web development to understand the concepts and get ahead with building their dream project.

  1. Follow the official tutorial provided in the Django Documentation and build a basic poll application.
  2. Challenge yourself! It’s time to try out a project of your own.

Project 💡 Create a blogging website.

  1. While working on your project learn more about using models, making queries, and the QuerySetAPI Reference.
  2. Learn more about the Django administration site.
  3. Get a grasp on writing views, templates, managing static files, and the URL dispatcher.
  4. Learn to write class based views, built-in class-based generic views, and pagination
  5. Learn how to use sessions.
  6. Learn about User Authentication in Django and how to use the Django Authentication System.
  7. Learn more about working with forms and the forms API, creating forms from models.
  8. Learn about the Django Security features.

Testing you Django Application 🏃‍♀️

It’s nearly impossible to develop a website that would run perfectly in the first go, so it is necessary to test your application. But as your project grows it’s is not so practical to manually test your app, to resolve this Django provides you a test framework to automate unit testing.

Check out the Workshop: Test-Driven Web Development with Django by San Diego Python’s Workshop.

Deploying Django 💥

Now that you have developed a fully tested website you might want to deploy it as well, to do so head over to the Django documentation where they explain the different ways to do the same.

You can also head over to the Heroku docs and learn how to configure you Django apps for Heroku.

Building RESTful APIs with Django 💪

Django REST framework is a powerful and flexible toolkit for building Web APIs.

Other Python Web Frameworks ✨

Resources to assist doing projects 👩‍💻

Some good starting projects:

  1. To-Do List
  2. Library management system
  3. An event website for College Fests

Tutorials 💡

Build a Basic Poll App: Official tutorial provided by Django Documentation 📃

Blogs 📝