Prefer Python over JavaScript? Now You Can Build Python WebApps with Ease

By Staff

March 9, 2022

Anvil, python-webapp


In this tutorial, we discuss how to use Anvil to build a ticketing app entirely in Python, integrating mock ups into the drag-and-drop designer. Anvil makes it simple to build large-scale, shippable new products with Python. Let’s get started with how to design a Python Webapp using Anvil.

This article was originally published by Anvil.

The End Result

Here it is! A fully-featured ticketing system, built entirely in Anvil.

The Process

Below, I’ve outlined the process involved in building the ticketing system, from concept to final product.

Read on to learn how you can build your own business applications with Anvil.

1. Requirements

The first step is to decide on the key requirements for your system:

Next, work through these requirements and decide on a list of screens that will satisfy each requirement.

I decided my ticketing system would need these screens:

  • Dashboard
  • Ticket inbox
  • Single ticket view
  • Customers view
  • Add a ticket view

2. Wireframes

Next, sketch up some simple wireframes for each of these screens, ready to send to your designers.

Here’s my wireframe for the ticket inbox:

3. Professional Design

Send your wireframes to a professional designer to provide mock ups of each of your screens.

Here’s the mock up for the wireframe above:

The ticket inbox design

4. Build the UI

The next step is to build your UI.

Anvil makes it simple to integrate custom designs into an app built with the drag-and-drop designer. For a step-by-step example on customising the look and feel of your Anvil apps, see this post on hand-drawn web apps.

Dropping components into the designer

Here’s the final view of the ticket inbox:

The final ticket inbox

5. Database

Next, you’ll want to set up your database. Anvil’s Data Tables are a full database system built on top of PostgreSQL, with a nice GUI for creating, editing and deleting tables. This makes it simple to define your schema.

Getting my database set up took a matter of minutes:

Setting up the database schema

6. Build the Application Logic With Python

Finally, the fun bit – writing the logic of your application with Python.

Anvil lets you write Python that runs in the browser, Python that runs on the server, and call your server functions from client-side Python with just one line of Python.

Writing Python that Runs in Browser

Wiring up the UI and components was great fun, and surprisingly simple – the backend of the ticketing system is less than 300 lines of Python.

Build Your New Product With Anvil

Anvil makes building large-scale, powerful applications simple, straightforward and fast. It does this by automating of a lot of the things that make web development using traditional tools slow, and painful. It can power anything from small, simple web apps to large-scale, fully-featured business applications.

You can build your whole new product yourself, all your need is a little Python.

This ticketing system has all the features of a traditional “CRUD” app, is rather nice on the eyes (if I do say so myself..) and it’s very powerful. It’s backed by Postgres, email-driven, and has built-in user authentication. It’s powered by Python running in the browser, as well as on the server, meaning that it’s extremely customisable – clone it into your account, and have a play around for yourself. Staff

About the author Staff

TechForCXO Weekly Newsletter
TechForCXO Weekly Newsletter

TechForCXO - Our Weekly Newsletter Delivering Technology Use Case Insights for CXOs