Skip to content

Learning Django

Django is an opinionated web framework for Python, which aims to reduce the amount of work required to build a web application.

It prefers 'Convention' over 'Configuration', meaning that, much like this book, it reduces the problem space and prevents 'analysis paralysis'. It also encourages, through convention, the use of good practices.

I like this way of standardising things. You make it so much easier to do things properly, that nobody can be bothered to do it wrong because it's more work! It's something that I will be advocating later in the book when we get to creating clinical standards in software.

What Django helps you with

  • Structuring your project in a logical way so that other developers can easily find their way around.
  • Definining a data model for the information your application will store.
  • Connecting the data in Python to a database or other 'persistence' type so that it can be saved for later.
  • Creating the HTML that the user will see in the web browser. It simplifies the task of 'mail merging' the fields from your database into the HTML page.
  • Security eg HTTPS, backend admin pages and translations/internationalisation (also called i18n' for short)
  • Accessibility and adherence to good practice.
  • Sharing your application as a 'module' that could be used in other applications.

How to learn Django

You should have a reasonable understanding of the Python language before starting to learn Django. If you have completed the free Python2 course on CodeCademy, as recommended in the Learn Python section, then you probably know enough.

Django uses Python syntax, but adds in quite a lot of new concepts on top. It can take a bit of time to feel familiar with what is happening.

As with the Python section, I'm not going to duplicate in this book material that is better explained elsewhere, so this is the point I hand you off to free places on the web where you can learn Django

https://www.djangoproject.com/ has a good landing page with some more of the benefits of Django listed, which are worth reading. From there, you can follow the instructions to install Django, and then I'd recommend to follow the Django Tutorial.

https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django is another good tutorial for Django.