To see what you can do with a WSGI application, let's create a simple example: a message wall where the messages are stored in a sqlite3 database and the URL is used to indicate the user and tags being searched for. Note that this is a simple example, and we won't be implementing any kind of security, session management, and so on, so don't use this in production. This application is intended to show you the possibilities for writing web applications in Python.
As you've seen, we need to create an application object to pass to the server when we create it. This application needs to be able to do the following:
■ Retrieve messages written by a user, and display them along with their ages: for example, "5 minutes ago," "2 days ago," and so on
■ Retrieve messages addressed to a user (messages beginning with @user), and display them and their ages
■ Display messages in chronological order from newest to oldest
■ Allow users to enter messages and store them in the database
Was this article helpful?