Django for Web Developmentπ
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.
A π₯οΈ with any OS βοΈ
A good light weight editor: VSCode, Atom, Sublime text βοΈ
Using super light Notepad Text Editor β
Basic programming knowledge in Python βοΈ
Familiarity with the basics of python OOP
Basic Web development knowledge βοΈ
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:
Installing an official release with pip.
This is the best way to get the latest stable version of Django.
Use a version from your computer’s package manager.
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.
- Follow the official tutorial provided in the Django Documentation and build a basic poll application.
- Challenge yourself! It’s time to try out a project of your own.
Project π‘ Create a blogging website.
- While working on your project learn more about using models, making queries, and the QuerySetAPI Reference.
- Learn more about the Django administration site.
- Get a grasp on writing views, templates, managing static files, and the URL dispatcher.
- Learn to write class based views, built-in class-based generic views, and pagination
- Learn how to use sessions.
- Learn about User Authentication in Django and how to use the Django Authentication System.
- Learn more about working with forms and the forms API, creating forms from models.
- 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:
- To-Do List
- Library management system
- An event website for College Fests
Tutorials π‘
Build a Basic Poll App: Official tutorial provided by Django Documentation π
- Django Girls Tutorial
- Django Web Framework (Python) - MDN-Mozilla:
- Django Tutorials - Real Python
- Django Framework (3.0) Crash Course Tutorials (Video)
- Django Tutorial for Beginners | Full Course (Video)
- Python Django Tutorial (Video)