PySummary3


SAISOFT PYT-PR: Session 10

Django, the web framework, uses Regular Expressions

Below we see how Python names a matched group, possibly less than the full match.

Regex101.com is a useful sandbox for practicing with Regular Expressions, once you learn what they are and roughly what they're good for.

Here we are practicing in Spyder, doing one of the exercises. Remember?


Django dispatches incoming URL requests to views, by matching regexes, perhaps extracting a group, and passing the argument on to a corresponding view.

I tend to use similar or identical flat file data sets across implementations, both to keep it simple and to facilitate comparing and contrasting the frameworks.


Django views may not have to use any SQL directly as the Object Relational Mapper (ORM) allows a more Pythonic way of interacting with the data.

Keep in mind that Django, as well as other frameworks, also provide a bridge to NoSQL data stores, such as MongoDB.


The tables have all been meticulously described to Django, allowing it to assist in many ways, including with data migrations should structures change.

Flask is not that different in terms of supplying a Model-View-Controller architecture. However Flask uses @app.router decorator syntax to pair URLs with corresponding View functions.

We have looked at both Flask and Django applications in this course, with opportunities to run them locally provided the necessary dependencies have been installed. Both are available to the conda installer.

Web2py is another open source website development framework you may want to try. Keep alert for new options. The Python Ecosystem remains dynamic!

The Future

At the cutting edge of current technology, especially in the open source sphere, is the Python GIS stack. This includes:

  • geopandas : like pandas but with geometry added (use a clean Anaconda environment)
  • Geodjango : handles geometry in the models (extends regular django)
  • PostGIS : an open source database with GIS extensions (other options available)

LAB:

Turn the above three bulleted items into live links to home pages for the respective technologies. Practice with Markdown!