Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
img
 
 
 
 
 
 
 
 
 
 
 
 
 
 

django

This repository is specifically meant to those who are looking into using Django, since this gives a good amount of information about Django and it's capabilities.

Disclaimer: I have also included a bootstrap boilerplate for this project.

Since newer versions of Python are often faster, have more features, and are better supported, the latest version of Python 3 is recommended.

Table of contents:

What is 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.

To give you an idea what the capabilities of Django are, here is a list of big companies that use Django:

Django's Architecture

django

Building web applications

Django has adopted Python’s "batteries included" approach, the framework has everything necessary to create a fully developed application without needing to install any packages. You can start building a simple application instantly without needing to customize it since all of the essentials are already available.

Django's structure mainly consists of:

  1. The Model Layer
  2. The Views Layer
  3. The Template Layer
  4. The Development Process
  5. Security
  6. The Admin
  7. Forms

Scalability

Django, at it's core is just a series of components of Python, wired up and ready to go. Components are not dependent on each other, since they are separate entities. You can choose, pick, unplug and replace them when your app requires for that to be done. Meaning you can build up to whatever level of performance you need, without compromising the functionality of your app.

Validation

Django follows the DRY principle. You have a Model and it has some fields with restrictions and rules e.g. integer field, string field with length constraint etc. You are going to take input from the users and want to save it in the Model and therefore need to validate the user inputs. You don’t have to write same fields and rules again. You just need to create a ModelForm class and it’ll use the field and rules from the Model class.

Security 🔒

By default, Django prevents most common security mistakes:

  • XSS (cross-site scripting) protection - Django template system by default escapes variables, unless they are explicitly marked as safe.

  • CSRF (cross site request forgery) protection - Django has built-in protection against most types of CSRF attacks, providing you have enabled and used it where appropriate.

  • SQL injection protection - Django uses built-in ORM, thus there is no risk of SQL injection (raw queries are possible, but by no means something that a beginner would need to use).

  • PBKDF2 password hashing - Django uses the PBKDF2 algorithm with a SHA256 hash, a password stretching mechanism recommended by NIST. It’s quite secure, requiring massive amounts of computing time to break. Depending on your requirements, you may choose a different algorithm, or even use a custom algorithm to match your specific security situation.

More on django security.

Packages 📦

If you happen to need more than Django offers, searching for "django" on PyPI finds lots of available for use.

A list of awesome Django packages (not in a specific order):

Documentation 📑

Django’s official documentation is more than enough. On top of that, Stack Overflow is well-stocked with questions & answers related to Django.

Open Source Community 🗃

Being open source and insanely popular, Django has created a helpful community.

Django has created a lot of libraries of its own, but not any for testing. It doesn’t mean that Django doesn’t support testing, it most certainly does. They have a complete section dedicated to testing. Python itself provides a great testing library for Django, so it wouldn't be very practical to develop a testing library.

Installing Django 🌩

  1. Install pip. The easiest is to use the standalone pip installer.

  2. Take a look at virtualenv and virtualenvwrapper. These tools provide isolated Python environments, which are more practical than installing packages systemwide.

  3. After you’ve created and activated a virtual environment (you do not need a virtual environment, but it is highly suggested).

Enter the command:

pip install django

You can also download it from GitHub directly

git clone https://github.com/django/django.git

Articles

Thanks

Thanks to these awesome contributors for helping with this repository.