1 Django unfolds

 

This chapter covers

  • What the Django Framework is and why to use it
  • The actions Django performs when you enter a URL in your browser
  • Server-side rendering vs single page applications
  • The kinds of projects you can do with Django

You’ve written a brilliant Python script that runs on your local machine and now want other people be able to use it. You can use magical packaging tools and send your program to your users, but then you’re still stuck with the challenge of whether they have Python installed. Python does not come by default on many computing platforms, and you have the added problem of making sure the Python version your script requires is installed on your user’s

Alternatively, you can turn your Python program into a web application. In this case, your user’s interface becomes a web browser, and those are installed everywhere. Your users no longer even need to know what Python is, they simply point their browser at the right URL and can use your software. To do this, your program needs to be adapted to run on a web server. This requires a bit of work, but also has the advantage of a single environment: you are in full control over what version of Python gets run.

1.1 Django’s Parts

1.1.1 Mapping URLs, Django views, and the MVC model

1.1.2 Databases: Dynamic sites need data

1.1.3 Structuring HTML for reuse

1.1.4 Multi-user sites

1.2 What can you do with Django?

1.2.1 Server Side, Single Page, and Mixed Page Applications

1.2.2 When and where you should use it

1.2.3 Potential projects

1.3 Summary