Python Web Runner

-->

  1. Python Web Runner Online
  2. Python Simulator
  3. Python Code Runner Download
  4. Python Web Runner Free

Azure Pipelines

In this article, you use Azure Pipelines continuous integration and continuous delivery (CI/CD) to deploy a Python web app to Azure App Service on Linux. You begin by running app code from a GitHub repository locally. You then provision a target App Service through the Azure portal. Finally, you create an Azure Pipelines CI/CD pipeline that automatically builds the code and deploys it to the App Service whenever there's a commit to the repository.

To give Python Web Developers a great starting point, we chose to use Gunicorn as the default web server. Since it is referenced in the default Dockerfile, it is included as a dependency in the requirements.txt file. Note: To use Gunicorn as your web server, it must be included in the requirements.txt file as an app dependency. It does not need.

Create a repository for your app code

If you already have a Python web app to use, make sure it's committed to a GitHub repository.

  • A complete and mature WebAssembly runtime for Python based on Wasmer. Features: Easy to use: The wasmer API mimics the standard WebAssembly API,; Fast: wasmer executes the WebAssembly modules as fast as possible, close to native speed,; Safe: All calls to WebAssembly will be fast, but more importantly, completely safe and sandboxed,; Modular: wasmer can compile the.
  • Run the program helloWeb3.py again, and see that you have been able to change the appearance of the output without changing the Python program itself. That is the aim of using the template html page, allowing the web output formatting to be managed mostly independently from the Python program.

Note

If your app uses Django and a SQLite database, it won't work for this walkthrough. For more information, see considerations for Django later in this article. If your Django app uses a separate database, you can use it with this walkthrough.

If you need an app to work with, you can fork and clone the repository at https://github.com/Microsoft/python-sample-vscode-flask-tutorial. The code is from the tutorial Flask in Visual Studio Code.

To test the example app locally, from the folder containing the code, run the following appropriate commands for your operating system:

Open a browser and navigate to http://localhost:5000 to view the app. When you're finished, close the browser, and stop the Flask server with Ctrl+C.

Provision the target Azure App Service

The quickest way to create an App Service instance is to use the Azure command-line interface (CLI) through the interactive Azure Cloud Shell. In the following steps, you use az webapp up to both provision the App Service and perform the first deployment of your app.

  1. Sign in to the Azure portal at https://portal.azure.com.

  2. Open the Azure CLI by selecting the Cloud Shell button on the portal's toolbar:

  3. The Cloud Shell appears along the bottom of the browser. Select Bash from the dropdown:

  4. In the Cloud Shell, clone your repository using git clone. For the example app, use:

    Replace <your-alias> with the name of the GitHub account you used to fork the repository.

    Tip

    To paste into the Cloud Shell, use Ctrl+Shift+V, or right-click and select Paste from the context menu.

    Note

    The Cloud Shell is backed by an Azure Storage account in a resource group called cloud-shell-storage-<your-region>. That storage account contains an image of the Cloud Shell's file system, which stores the cloned repository. There is a small cost for this storage. You can delete the storage account at the end of this article, along with other resources you create.

  5. In the Cloud Shell, change directories into the repository folder that has your Python app, so the az webapp up command will recognize the app as Python.

  6. In the Cloud Shell, use az webapp up to create an App Service and initially deploy your app.

    Change <your-appservice> to a name for your app service that's unique across Azure. Typically, you use a personal or company name along with an app identifier, such as <your-name>-flaskpipelines. The app URL becomes <your-appservice>.azurewebsites.net.

    When the command completes, it shows JSON output in the Cloud Shell.

    Tip

    If you encounter a 'Permission denied' error with a .zip file, you may have tried to run the command from a folder that doesn't contain a Python app. The az webapp up command then tries to create a Windows app service plan, and fails.

  7. If your app uses a custom startup command, set the az webapp config property. For example, the python-sample-vscode-flask-tutorial app contains a file named startup.txt that contains its specific startup command, so you set the az webapp config property to startup.txt.

    1. From the first line of output from the previous az webapp up command, copy the name of your resource group, which is similar to <your-name>_rg_Linux_<your-region>.

    2. Enter the following command, using your resource group name, your app service name (<your-appservice>), and your startup file or command (startup.txt).

      Again, when the command completes, it shows JSON output in the Cloud Shell.

  8. To see the running app, open a browser and go to http://<your-appservice>.azurewebsites.net. If you see a generic page, wait a few seconds for the App Service to start, and refresh the page.

    Note

    For a detailed description of the specific tasks performed by the az webapp up command, see Provision an App Service with single commands at the end of this article.

Create an Azure DevOps project and connect to Azure

To deploy to Azure App Service from Azure Pipelines, you need to establish a service connection between the two services.

  1. In a browser, go to dev.azure.com. If you don't yet have an account on Azure DevOps, select Start free and get a free account. If you have an account already, select Sign in to Azure DevOps.

    Important

    To simplify the service connection, use the same email address for Azure DevOps as you use for Azure.

  2. Once you sign in, the browser displays your Azure DevOps dashboard, at the URL https://dev.azure.com/<your-organization-name>. An Azure DevOps account can belong to one or more organizations, which are listed on the left side of the Azure DevOps dashboard. If more than one organization is listed, select the one you want to use for this walkthrough. By default, Azure DevOps creates a new organization using the email alias you used to sign in.

    A project is a grouping for boards, repositories, pipelines, and other aspects of Azure DevOps. If your organization doesn't have any projects, enter the project name Flask Pipelines under Create a project to get started, and then select Create project.

    If your organization already has projects, select New project on the organization page. In the Create new project dialog box, enter the project name Flask Pipelines, and select Create.

  3. From the new project page, select Project settings from the left navigation.

  4. On the Project Settings page, select Pipelines > Service connections, then select New service connection, and then select Azure Resource Manager from the dropdown.

  5. In the Add an Azure Resource Manager service connection dialog box:

    1. Give the connection a name. Make note of the name to use later in the pipeline.
    2. For Scope level, select Subscription.
    3. Select the subscription for your App Service from the Subscription drop-down list.
    4. Under Resource Group, select your resource group from the dropdown.
    5. Make sure the option Allow all pipelines to use this connection is selected, and then select OK.

    The new connection appears in the Service connections list, and is ready for Azure Pipelines to use from the project.

    Note

    If you need to use an Azure subscription from a different email account, follow the instructions on Create an Azure Resource Manager service connection with an existing service principal.

Create a Python-specific pipeline to deploy to App Service

  1. From your project page left navigation, select Pipelines.

  2. Select Create Pipeline:

  3. On the Where is your code screen, select GitHub. You may be prompted to sign into GitHub.

  4. On the Select a repository screen, select the repository that contains your app, such as your fork of the example app.

  5. You may be prompted to enter your GitHub password again as a confirmation, and then GitHub prompts you to install the Azure Pipelines extension:

    On this screen, scroll down to the Repository access section, choose whether to install the extension on all repositories or only selected ones, and then select Approve and install:

  6. On the Configure your pipeline screen, select Python to Linux Web App on Azure.

    Your new pipeline appears. When prompted, select the Azure subscription in which you created your Web App.

    • Select the Web App
    • Select Validate and configure

    Azure Pipelines creates an azure-pipelines.yml file that defines your CI/CD pipeline as a series of stages, Jobs, and steps, where each step contains the details for different tasks and scripts. Take a look at the pipeline to see what it does. Make sure all the default inputs are appropriate for your code.

YAML pipeline explained

The YAML file contains the following key elements:

  • The trigger at the top indicates the commits that trigger the pipeline, such as commits to the main branch.

  • The variables that parameterize the YAML template

    Tip

    To avoid hard-coding specific variable values in your YAML file, you can define variables in the pipeline's web interface instead. For more information, see Variables - Secrets.

  • The stages

    • Build stage, which builds your project, and a Deploy stage, which deploys it to Azure as a Linux web app.
    • Deploy stage that also creates an Environment with default name same as the Web App. You can choose to modify the environment name.
  • Each stage has a pool element that specifies one or more virtual machines (VMs) in which the pipeline runs the steps. By default, the pool element contains only a single entry for an Ubuntu VM. You can use a pool to run tests in multiple environments as part of the build, such as using different Python versions for creating a package.

  • The steps element can contain children like task, which runs a specific task as defined in the Azure Pipelines task reference, and script, which runs an arbitrary set of commands.

  • The first task under Build stage is UsePythonVersion, which specifies the version of Python to use on the build agent. The @<n> suffix indicates the version of the task. The @0 indicates preview version.Then we have script-based task that creates a virtual environment and installs dependencies from file (requirements.txt).

  • Next step creates the .zip file that the steps under deploy stage of the pipeline deploys. To create the .zip file, add an ArchiveFiles task to the end of the YAML file:

    You use $() in a parameter value to reference variables. The built-in Build.SourcesDirectory variable contains the location on the build agent where the pipeline cloned the app code. The archiveFile parameter indicates where to place the .zip file. In this case, the archiveFile parameter uses the built-in variable Build.ArtifactsStagingDirectory.

    Important

    When deploying to Azure App Service, be sure to use includeRootFolder: false. Otherwise, the contents of the .zip file are put in a folder named s, for 'sources,' which is replicated on the App Service. The App Service on Linux container then can't find the app code.

  • Then we have the task to upload the artifacts.

  • In the Deploy stage, we use the deployment keyword to define a deployment job targeting an environment. By using the template, an environment with same name as the Web app is automatically created if it doesn't already exist. Alternatively you can pre-create the environment and provide the environmentName

  • Within the deployment job, first task is UsePythonVersion, which specifies the version of Python to use on the build agent.

  • We then use the AzureWebApp task to deploy the .zip file to the App Service you identified by the azureServiceConnectionId and webAppName variables at the beginning of the pipeline file. Paste the following code at the end of the file:

    The StartupCommand parameter shown here is specific to the python-vscode-flask-tutorial example code, which defines the app in the startup.py file. By default, Azure App Service looks for the Flask app object in a file named app.py or application.py. If your code doesn't follow this pattern, you need to customize the startup command. Django apps may not need customization at all. For more information, see How to configure Python on Azure App Service - Customize startup command.

    Also, because the python-vscode-flask-tutorial repository contains the same startup command in a file named startup.txt, you could specify that file in the StartupCommand parameter rather than the command, by using StartupCommand: 'startup.txt'.

Run the pipeline

You're now ready to try it out!

  1. Select Save at upper right in the editor, and in the pop-up window, add a commit message and select Save.

  2. Select Run on the pipeline editor, and select Run again in the Run pipeline dialog box. Azure Pipelines queues another pipeline run, acquires an available build agent, and has that build agent run the pipeline.

    The pipeline takes a few minutes to complete, especially the deployment steps. You should see green checkmarks next to each of the steps.

    If there's an error, you can quickly return to the YAML editor by selecting the vertical dots at upper right and selecting Edit pipeline:

  3. From the build page, select the Azure Web App task to display its output. To visit the deployed site, hold down the Ctrl key and select the URL after App Service Application URL.

    If you're using the Flask example, the app should appear as follows:

Important

If your app fails because of a missing dependency, then your requirements.txt file was not processed during deployment. This behavior happens if you created the web app directly on the portal rather than using the az webapp up command as shown in this article.

The az webapp up command specifically sets the build action SCM_DO_BUILD_DURING_DEPLOYMENT to true. If you provisioned the app service through the portal, however, this action is not automatically set.

The following steps set the action:

  1. Open the Azure portal, select your App Service, then select Configuration.
  2. Under the Application Settings tab, select New Application Setting.
  3. In the popup that appears, set Name to SCM_DO_BUILD_DURING_DEPLOYMENT, set Value to true, and select OK.
  4. Select Save at the top of the Configuration page.
  5. Run the pipeline again. Your dependencies should be installed during deployment.

Run a post-deployment script

A post-deployment script can, for example, define environment variables expected by the app code. Add the script as part of the app code and execute it using startup command.

To avoid hard-coding specific variable values in your YAML file, you can instead define variables in the pipeline's web interface and then refer to the variable name in the script. For more information, see Variables - Secrets.

Considerations for Django

As noted earlier in this article, you can use Azure Pipelines to deploy Django apps to Azure App Service on Linux, provided that you're using a separate database. You can't use a SQLite database, because App Service locks the db.sqlite3 file, preventing both reads and writes. This behavior doesn't affect an external database.

As described in Configure Python app on App Service - Container startup process, App Service automatically looks for a wsgi.py file within your app code, which typically contains the app object. If you need to customize the startup command in any way, use the StartupCommand parameter in the AzureWebApp@1 step of your YAML pipeline file, as described in the previous section.

When using Django, you typically want to migrate the data models using manage.py migrate after deploying the app code. You can add startUpCommand with post-deployment script for this purpose:

Run tests on the build agent

As part of your build process, you may want to run tests on your app code. Tests run on the build agent, so you probably need to first install your dependencies into a virtual environment on the build agent computer. After the tests run, delete the virtual environment before you create the .zip file for deployment. The following script elements illustrate this process. Place them before the ArchiveFiles@2 task in the azure-pipelines.yml file. For more information, see Run cross-platform scripts.

You can also use a task like PublishTestResults@2 to make test results appear in the pipeline results screen. For more information, see Build Python apps - Run tests.

Provision an App Service with single commands

The az webapp up command used earlier in this article is a convenient method to provision the App Service and initially deploy your app in a single step. If you want more control over the deployment process, you can use single commands to accomplish the same tasks. For example, you might want to use a specific name for the resource group, or create an App Service within an existing App Service Plan.

The following steps perform the equivalent of the az webapp up command:

  1. Create a resource group.

    A resource group is a collection of related Azure resources. Creating a resource group makes it easy to delete all those resources at once when you no longer need them. In the Cloud Shell, run the following command to create a resource group in your Azure subscription. Set a location for the resource group by specifying the value of <your-region>. JSON output appears in the Cloud Shell when the command completes successfully.

  2. Create an App Service Plan.

    An App Service runs inside a VM defined by an App Service Plan. Run the following command to create an App Service Plan, substituting your own values for <your-resource-group> and <your-appservice-plan>. The --is-linux is required for Python deployments. If you want a pricing plan other than the default F1 Free plan, use the sku argument. The --sku B1 specifies the lower-price compute tier for the VM. You can easily delete the plan later by deleting the resource group.

    Again, you see JSON output in the Cloud Shell when the command completes successfully.

  3. Create an App Service instance in the plan.

    Run the following command to create the App Service instance in the plan, replacing <your-appservice> with a name that's unique across Azure. Typically, you use a personal or company name along with an app identifier, such as <your-name>-flaskpipelines. The command fails if the name is already in use. By assigning the App Service to the same resource group as the plan, it's easy to clean up all the resources at once.

    Note

    If you want to deploy your code at the same time you create the app service, you can use the --deployment-source-url and --deployment-source-branch arguments with the az webapp create command. For more information, see az webapp create.

    Tip

    If you see the error message 'The plan (name) doesn't exist', and you're sure that the plan name is correct, check that the resource group specified with the -g argument is also correct, and the plan you identify is part of that resource group. If you misspell the resource group name, the command doesn't find the plan in that nonexistent resource group, and gives this particular error.

  4. If your app requires a custom startup command, use the az webapp config set command, as described earlier in Provision the target Azure App Service. For example, to customize the App Service with your resource group, app name, and startup command, run:

    The App Service at this point contains only default app code. You can now use Azure Pipelines to deploy your specific app code.

Clean up resources

To avoid incurring ongoing charges for any Azure resources you created in this walkthrough, such as a B1 App Service Plan, delete the resource group that contains the App Service and the App Service Plan. To delete the resource group from the Azure portal, select Resource groups in the left navigation. In the resource group list, select the ... to the right of the resource group you want to delete, select Delete resource group, and follow the prompts.

Python Web Runner Online

You can also use az group delete in the Cloud Shell to delete resource groups.

To delete the storage account that maintains the file system for Cloud Shell, which incurs a small monthly charge, delete the resource group that begins with cloud-shell-storage-.

Next steps

Contents

  1. Web Frameworks for Python

A Web framework is a collection of packages or modules which allow developers to write Web applications (see WebApplications) or services without having to handle such low-level details as protocols, sockets or process/thread management.

Python Simulator

The majority of Web frameworks are exclusively server-side technology, although, with the increased prevalence of AJAX, some Web frameworks are beginning to include AJAX code that helps developers with the particularly tricky task of programming (client-side) the user's browser. At the extreme end of the client-side Web Frameworks is technology that can use the web browser as a full-blown application execution environment (a la gmail for example): see Web Browser Programming for details.

As a developer using a framework, you typically write code which conforms to some kind of conventions that lets you 'plug in' to the framework, delegating responsibility for the communications, infrastructure and low-level stuff to the framework while concentrating on the logic of the application in your own code. This 'plugging in' aspect of Web development is often seen as being in opposition to the classical distinction between programs and libraries, and the notion of a 'mainloop' dispatching events to application code is very similar to that found in GUI programming.

Generally, frameworks provide support for a number of activities such as interpreting requests (getting form parameters, handling cookies and sessions), producing responses (presenting data as HTML or in other formats), storing data persistently, and so on. Since a non-trivial Web application will require a number of different kinds of abstractions, often stacked upon each other, those frameworks which attempt to provide a complete solution for applications are often known as full-stack frameworks in that they attempt to supply components for each layer in the stack.

Many frameworks now provide an element of customization in their support for the above activities and abstractions, utilizing components in that they provide abstractions only for certain specific things. As a result, it can be possible for you to build your own full-stack framework almost entirely from existing components.

1.1. Popular Full-Stack Frameworks

A web application may use a combination of a base HTTP application server, a storage mechanism such as a database, a template engine, a request dispatcher, an authentication module and an AJAX toolkit. These can be individual components or be provided together in a high-level framework.

These are the most popular high-level frameworks. Many of them include components listed on the WebComponents page.

Name

Latest version

Latest update date

description

3.2.3 (LTS)

2021-05-13

The Web framework for perfectionists (with deadlines). Django makes it easier to build better Web apps more quickly and with less code. Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. It lets you build high-performing, elegant Web applications quickly. Django focuses on automating as much as possible and adhering to the DRY (Don't Repeat Yourself) principle. The last release supporting Python 2.7 is 1.11 LTS. See Django

2.4.3

2020-03-01

the rapid Web development webframework you've been looking for. Combines SQLAlchemy (Model) or Ming (MongoDB Model), Kajiki (View), Repoze and ToscaWidgets2. Create a database-driven, ready-to-extend application in minutes. All with designer friendly templates, easy AJAX on the browser side and on the server side, with an incredibly powerful and flexible Object Relational Mapper (ORM), and with code that is as natural as writing a function. After reviewing the Documentation, check out the Tutorials

2.21.1

2020-11-28

* Python 2.7, Python 3.5+, PyPy * All in one package with no further dependencies. Development, deployment, debugging, testing, database administration and maintenance of applications can be done via the provided web interface, but not required. * web2py has no configuration files, requires no installation, can be run off a USB drive. * web2py uses Python for the Model, View and the Controller * Built-in ticketing system to manage errors * Internationalization engine and pluralization, caching system * Flexible authentication system (LDAP, MySQL, janrain etc) * NIX(Linux, BSD), Windows, Mac OSX, tested on EC2, Webfaction * works with MySQL, PostgreSQL, SQLite , Firebird, Oracle, MSSQL and the Google App Engine via an ORM abstraction layer. * Includes libraries to handle HTML/XML, RSS, ATOM, CSV, RTF, JSON, AJAX, XMLRPC, WIKI markup. * Production ready, capable of upload/download of very large files * Emphasis on backward compatibility.

See below for some other arguably less popular full-stack frameworks!

1.2. Other Full-Stack Frameworks

These frameworks also provide most, if not all of the technology stack. However, they are regarded as not being as popular as the frameworks listed above.

Name

Latest version

Latest update date

description

3.30

2021-04-09

a semantic web application framework featuring a query language, a selection+view mechanism, multiple databases, security, workflows, reusable components, etc.

1.20.0

2021-04-09

Dash is the most downloaded, trusted framework for building ML & data science web apps.

1.2.2

2020-06-30

Scalable and heterogeneous web toolkit sitting on top of Django and others. Django-hotsauce is a pragmatic fork of Django 1.x API to develop scalable and extensible WSGI applications in Python. Source codeDevelopment Wiki

0.10.5

2013-01-18

a strict MVC framework that strictly separated Model, View and Controller elements so that Designers, Web Developers, and Sysadmins can work independently of each other. Giotto includes controller modules that allow applications to be built on top of the web, irc or the command line.

3.2

2020-09-02

built on the existing Zope 3 libraries, but aims to provide an easier learning curve and a more agile development experience. It does this by placing an emphasis on convention over configuration and DRY (Don't Repeat Yourself).

5.4.112

2021-05-31

Jam.py primary goal is to allow development of database-driven business web applications easily and quickly, based on DRY (another 'Don't Repeat Yourself') principle, with emphasis on CRUD. Jam.py has no configuration files, requires no installation other than pip or unzip, can be run as portable App.

1.0.3

2018-01-12

a lightweight Web framework emphasizing flexibility and rapid development. It combines the very best ideas from the worlds of Ruby, Python and Perl, providing a structured but extremely flexible Python Web framework. It was also one of the first projects to leverage the emerging WSGI standard, which allows extensive re-use and flexibility but only if you need it. Out of the box, Pylons aims to make Web development fast, flexible and easy. Pylons is built on top of Paste (see below). NOTE: Pylons the web framework is in maintenance-only status after merging with Pyramid to form the Pylons Project to develop web technologies using Python.

5.1.1

2021-06-17

With Reahl, programming is done purely in Python, using concepts familiar from GUI programming - like reusable Widgets and Events.

1.0a13

2019-06-26

A full stack Python framework for building consumer and business web applications. Websauna builds upon Pyramid, SQLAlchemy, and other mature open source components. Jupyter Notebook is directly integrated to Websauna. Analyzing website data and building interactive visualizations is within a reach of one click. Websauna needs Python 3.5.2 or newer.

3.0.1

2020-12-30

A lightweight, high performance, high concurrency WSGI web framework with the key features to build modern, efficient web. Requires Python 2.4-2.7 or 3.2+. MVC architectural pattern (push-based). Includes routing, model update/validation, authentication/authorization, contentcaching with dependency, xsrf/resubmission protection, AJAX+JSON, i18n (gettext), middlewares, and more. Template engine agnostic (integration with: jinja2, mako, tenjin and wheezy template) plus html widgets.

5.2

2021-05-21

Being the grandaddy of Python web frameworks, Zope has grown into a family of frameworks over the years. Zope 1 was released in 1999. Zope 2 is both a web framework and a general purpose application server, today it is primarily used by ContentManagementSystems. Zope 3 is both a standalone framework and a collection of related libraries, which are also included with newer releases of Zope 2. All of the Zope frameworks include the ZODB, an object database for Python.

4.1.2

2019-09-19

  • Kiss.py (1.0.0 Released 2014-06-23) MVC web framework in Python with Gevent, Jinja2, Werkzeug.

  • Lino (19.11.0 Released 2019-11-11), a framework for creating customized enterprise-level Rich Internet Applications using Sencha ExtJS and Django.

  • Nagare (0.5.1 Released 2018-01-25) - a new approach for the rapid development of web applications, thanks to advanced features like truely autonomous and reusable components, continuation, programmatic HTML/XML, automatic AJAX rendering and database ORM.

  • Pylatte (1.0 Released 2013-02-03) - Pylatte is Python3-based web framework. Pylatte is used pyl code to make web site. pyl code is compose to python and HTML. so pyl code seem like php code. easy to learn, easy to run.

  • Tipfy (1.0b3 Released 2011-07-18) tipfy is a small but powerful framework made specifically for Google App Engine.

  • Tornado (6.1 Released 2020-10-30) is an open source version of the scalable, non-blocking web server and and tools that power FriendFeed (acquired by Facebook with this project released as open source).

  • watson-framework (3.5.4 Released 2019-10-07, initial release 2012-11-26) A component based WSGI web framework giving you the tools needed to build your web apps quickly and easily:

    • Requires Python 3.3+.
    • MVC based architecture
    • Dependency injection
    • Event driven
  • webapp2 (3.0.0b1 Released 2016-09-13) - a lightweight framework compatible with Google App Engine’s webapp: it extends webapp to add better URI routing and exception handling, a full featured response object and a more flexible dispatching mechanism. Also offers sessions, localization, internationalization, domain and subdomain routing and secure cookies. Can be used outside of App Engine, independently of the App Engine SDK.

  • WebBot (0.5.0 Released 2013-04-10) - A QT inspired web framework that includes a graphical interface builder, AJAX abstraction, and integration support for Google's AppEngine.

  • WebCore (2.0.4 Released 2020-05-12) A full-stack, light-weight and efficient web development framework. Web applications as simple as a single file, or as structured as you want. Utilizes popular WSGI components, ORMs, etc. without locking you in, and offers a unique init.d-like middleware configuration.

  • web.py (0.6.2 Released 2020-11-09) Think about the ideal way to write a Web app. Write the code to make it happen.

  • Webware for Python 3 (3.0.3 Released 2021-04-30) is a time-tested suite of Python packages and tools for developing object-oriented, web-based applications.

  • Werkzeug (2.0.1 Released 2021-05-18) is Unicode-aware, includes a powerful debugger, full featured request and response objects, HTTP utilities to handle entity tags, cache control headers, HTTP dates, cookie handling, file uploads, a powerful URL routing system and a bunch of community contributed addon modules.

  • WHIFF (1.1 Released 2013-07-09) WHIFF is a collection of support services for WSGI/Python web applications which allows applications to be composed by 'dropping' dynamic pages into container directories. It automatically includes support for advanced features such as AJAX, jQueryUI widgets, Flash based charts and more. Extensive documentation and tutorial essays.

1.3. Popular Non Full-Stack Frameworks

These projects provide the base 'application server', either running as its own independent process, upon Apache or in other environments. On many of these you can then introduce your own choice of templating engines and other components to run on top, although some may provide technologies for parts of the technology stack.

Name

Latest Release

Description

aiohttp
(pypi: aiohttp)

174

3.6.2 (2019-10-09)

Async http client/server framework

Bottle
(pypi: bottle)

374

0.12.19 (2020-11-11)

a fast and simple micro-framework for small web-applications. It offers request dispatching (Routes) with url parameter support, Templates, key/value Databases, a build-in HTTP Server and adapters for many third party WSGI/HTTP-server and template engines. All in a single file and with no dependencies other than the Python Standard Library.

CherryPy
(pypi: CherryPy)

860

18.6.0 (2020-04-17)

a pythonic, object-oriented HTTP framework. CherryPy powered web applications are in fact stand-alone Python applications embedding their own multi-threaded web server. TurboGears, web2py (see above) also use CherryPy.

Falcon
(pypi: falcon)

1022

3.0.1 (2021-05-11)

- lightweight, API-oriented framework designed to be fast. Falcon powers the popular Hug web framework. Supports Python 2.7 and 3.

FastAPI
(pypi: fastapi)

1207

0.65.1 (2021-05-12)

a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.

Flask
(pypi: Flask)

62

2.0.1 (2021-05-21)

“a microframework for Python based on Werkzeug, Jinja 2 and good intentions.” Includes a built-in development server, unit tesing support, and is fully Unicode-enabled with RESTful request dispatching and WSGI compliance.

Hug
(pypi: hug)

>4000

2.6.1 (2020-02-06)

Embrace the APIs of the future. Hug aims to make developing APIs as simple as possible, but no simpler. It's one of the first fully future looking frameworks: only supporting Python3+.

Pyramid
(pypi: pyramid)

1568

2.0 (2021-02-28)

a small, fast, down-to-earth, open source Python web development framework. It makes real-world web application development and deployment more fun, more predictable, and more productive. Pyramid is a Pylons Project, and is the successor to the Pylons web framework.

Quart
(pypi: Quart)

3555

0.15.0 (2021-05-12)

a Python ASGI web microframework. It is intended to provide the easiest way to use asyncio functionality in a web context, especially with existing Flask apps.

1.4. Other Non Full-Stack Frameworks

  • Albatross (1.42 Released 2011-04-27) a small and flexible Python toolkit for developing highly stateful Web applications; deploys to CGI, FastCGI, and ModPython servers.

  • Aquarium (2.3 Released 2007-01-01) offers convenient libraries, tight integration with Cheetah, adaptors for various Web environments; deploys to CGI, FastCGI, and ModPython servers.

  • AppWsgi - illustration of building your own ajax framework running on a mod_wsgi apache server

  • BlueBream (1.0 Released 2011-01-18) is a web framework best suited for medium to large projects split into many interchangeable and reusable components. Formerly known as Zope 3, and based on Zope Toolkit (ZTK).

  • Bobo (2.4.0 Released 2017-05-17) is a light-weight framework for creating WSGI web applications. Its goal is to be easy to use and remember. It addresses 2 problems: 1) mapping URLs to objects and 2) calling objects to generate HTTP responses. Bobo doesn't have a templating language, a database integration layer, or a number of other features that are better provided by WSGI middle-ware or application-specific libraries. Bobo builds on other frameworks, most notably WSGI and WebOb.

  • Bocadillo (0.18.3 Released 2019-10-22) is the Python web framework filled with asynchronous salsa. This async-first framework ships with carefully chosen included batteries which help you build performant web apps and services with minimal setup. Bocadillo has core support for both HTTP and WebSocket and is built on top of Starlette and Uvicorn. Python 3.6+ only. (Note: Bocadillo is now UNMAINTAINED. Users are recommended to migrate to a supported alternative, such as Starlette or FastAPI.)

  • circuits (3.2.1 Released 2020-10-30) is a component based, event-driven light weight and high performance HTTP/WSGI framework. circuits has some similar features to CherryPy (see above), such as CherryPy's URL mapping. circuits applications are stand-alone applications with a high performance, multi-process web server with great concurrent scalability with full support for WSGI and deployment with other web servers.

  • Clastic (21.0.0 released 2021-05-14) is a functional web microframework that streamlines explicit development practices while eliminating global state. It's built on top of Werkzeug, so it's immediately familiar to Flask users, and WSGI, so it deploys the same as other Python web applications. It has a powerful and intuitive routing system, built-in development server, and metadata application. See this PayPal Engineering post for examples and screenshots.

  • Divmod Nevow (0.14.5 Released 2019-12-15) a comprehensive library including a resource model encouraging the separation of application and presentation logic, a markup system with support for designer-friendly XHTML templates and pure-Python templates, and a robust AJAX-like API (Divmod Athena) which supports the creation of highly dynamic Web pages in a structured manner.

  • Growler (0.8.0 Released 2016-09-07) - A micro web-framework built atop asyncio coroutines and chained middleware, that provides an easy way to implement complex applications.

  • Gunstar (0.2.2 released 2013-09-06) is a microframework based on WebOb and Jinja2.

  • Klein (20.6.0 released 2020-06-08) is a micro-framework for developing production-ready web services with Python. It is 'micro' in that it has an incredibly small API similar to Bottle and Flask. It is not 'micro' in that it depends on things outside the standard library. This is primarily because it is built on widely used and well tested components like Werkzeug and Twisted.

  • Lona (1.7.2 released 2021-09-28) is a web application framework, designed to write responsive web apps in full Python. Lona handles the server- and client side, and provides a simple, pythonic API to write self contained views, without any Javascript.

  • MorePath (0.19 released 2020-01-30) Morepath is a Python web microframework, with super powers. It uses routing, but the routing is to models. Morepath is model-driven and flexible, which makes it expressive.

  • Pycnic (0.0.9 Released 2016-05-20) - A web framework that is object oriented and optimized for JSON APIs. Pycnic only includes the tools needed for web API creation allowing for a lighter footprint than most other frameworks. Supports Python 2.7 and 3.

  • Python Paste (1.7.5.1 Released 2010-09-20) brings consistency to Python Web development and Web application installation, providing tools for both developers and system administrators. Also, Pylons (see above) is built on top of Paste.

  • PyWebLib (1.3.13 Released 2017-01-18) - provides support for forms and sessions; used to implement web2ldap

  • Quart (0.15.0 Released 2021-05-12) is a Python web microframework based on Asyncio. It is intended to provide the easiest way to use the asyncio functionality in a web context, especially with existing Flask apps. This is possible as Quart has the same API as Flask.

  • Quixote (3.3 Released 2021-01-25) Allows developers to develop dynamic Web sites while using as much of their existing Python knowledge as possible

  • Responder (2.0.7 released 2021-01-08) is a web service framework, that lets you easily serve a ASGI app, with a production static files server (WhiteNoise) pre-installed, jinja2 templating (without additional imports), and a production webserver based on uvloop, serving up requests with gzip compression automatically.

  • Sanic (21.3.4 Released 2021-04-20) - A Flask-like Python 3.5+ web server that's written to go fast.

  • Spinne (1.0.1 Released 2014-05-17) - A simple, easy and fast micro web framework for python 3.x.

  • weblayer (0.4.3 Released 2011-02-03) - weblayer is a lightweight, componentised Python package for writing web applications.

  • WebStack (1.2.7 Released 2007-10-29) - very lightweight, requiring layers of extra technology (such as XSLTools and others) to match full-stack frameworks in feature comparisons

  • WSGIServlets (1.0.1 Released 2011-11-09) - lightweight, object-oriented framework that doesn't get in your way. Intuitive class hierarchy makes coding WSGI applications, middleware or full-blown CMS and frameworks a simple task by providing developers a rich set of tools out-of-the-box. A link to a live tutorial (written with WSGIServlets) is available on the project's homepage. The tutorial is also included in the distribution along with a complete API reference manual.

1.5. Discontinued/Inactive Frameworks

The following frameworks are either discontinued, in that their developers may have stated that they no longer maintain the code, or appear to be inactively developed or maintained, in that the Web site for the project has remained unchanged for an extended period of time.

  • 4Suite (the server product seems to receive relatively infrequent updates and the site is often down)

  • Crusader is a powerful application server for Python based upon a scalable, extensible and easy-to-use general purpose server framework.

  • Cymbeline (1.3.1 Released 2005-12-09) an application server framework, including functionality such as DB and arbitrary object pooling, Web servers, persistent object repository, and a text console. As of 2013-08-13, this is a dead link.

  • Enamel - an abstraction layer over Twisted, Nevow, Formal and SQLAlchemy to converge their concepts under a single framework (Link no longer works)

  • GAE framework - (1.0 PRE, Released 2011-05-84) is a Python web framework that's designed for high-load web sites build on Google App Engine; Note: The project website appears to have been closed down: http://www.gaeframework.com

  • Gizmo(QP) (0.7 Released 2007-04-17) extends QP (see below) adding functionality to help with building rich and exacting web interfaces. Includes a Form module that supports (redundant) automatically generated client-side field validation as well as additional json callbacks.

  • Glashammer (0.2.1 Released 2009-03-31) is a full stack Python web framework with an emphasis on simplicity, flexibility, and extensibility. It is built atop excellent components and reinvents zero wheels. WSGI, routing, templating, forms, data, plugins, config, events, SQLAlchemy, Storm, Couchdb, OpenID, AppEngine, Jquery, etc.

  • Karrigell (3.1.1 Released 2010-09-02) is a flexible Python web framework, with a clear and intuitive syntax. It is independent from any database, ORM or templating engine, and lets the programmer choose between a variety of coding styles. A version for Python3.2+ (4.3.10 Released 2013-05-26) is was available at http://code.google.com/p/karrigell/

  • maki (developers no longer use the product)

  • Porcupine (0.6 Released 2009-07-18) provides everything you need for building modern and directs people to Django and/or Pylons)

  • Python Server Pages, or PSP (old Web site from 1999, dead link)

  • Python Servlet Engine (3.0.4 Released 2006-02-17) PSE parses your templates into byte compiled 'servlets' to produce Web pages that run fast. (site says: 'NOTE: The PSE Project is officially closed as of 3/28/2010')

  • QP (2.2 Released 2009-08-25) a package for defining and running multiple Web applications that are based on Durus for persistence, offering standard persistent Session and User classes, easy interactive database sessions, and QPY for safely assembling html. Packages require and run on Python >= 2.4 and yes that includes Python 3.x with the same code base!

  • Repoze.bfg (1.3) BFG is a 'pay only for what you eat' Python web framework . BFG is a Python web application framework based on WSGI. BFG is also referred to as repoze.bfg. Ancestor of (and supplanted by) Pyramid.

  • SkunkWeb (3.4.0 Released 2004-09-10)

  • Snakelets (1.50 Released 2008-10) simple-to-use Python Web application server. Announced as discontinued upon release of version 1.50. As of 2013-08-13, dead link

  • Spark (0.2.1 Released 2006-9-15) Fast and lightweight Web kit. Supports mod_python, WSGI, Twisted. (2010-03-15, site hasn't responded for a week or so, seems dead; 2013-08-13, dead link).

  • Spiked (0.1.3 Released 2010-01-23) - web development framework built on a top of Twisted and Cheetah.

  • Spyce (2.1.3 Released 2006-11-17)

  • Wasp (2.00 Released 2007.07) - supports command-line, CGI and embedded web server modes, with templating, session mechanism and other modules emphasizing ease of use and familiar paradigms. (2010-03-15, website indicates that it is no longer active: 'I AM SORRY BUT WASP WILL NOT BE RETURNING. I simply have no time for this venture, seeing as how I am working towards my masters...'; 2013-08-13, dead link)

Code runner python

1.6. Books and Articles

  • Steve Holden wrote a book on Python Web Programming. The book from John Goerzen, Foundations of Python Network Programming, can also be useful. O'Reilly's Programming Python 3rd Edition has 500 pages on Internet programming, including 250 on Web scripting. Finally, check out the Web Programming chapter in Core Python Programming by Wesley Chun -- there is also a small section elsewhere on Web APIs.

  • The Zope 3 Quick Start Guide gives a short introduction to Zope 3.

1.7. Content Management Systems

Content management systems (CMS) often allow you to build applications like functionality upon them and typically provide many of the facilities seen in full-stack frameworks. See ContentManagementSystems for more details.

1.8. Web Components

Some frameworks promote interoperable components for things like templating/output and authentication/authorization, and so you might see users of different frameworks actually using the same component or library. See WebComponents for details of such components.

1.9. Web Client Frameworks

Python Code Runner Download

In contrast to server-oriented frameworks which may offer AJAX (asynchronous JavaScript and XML) support by serving pre-packaged (inflexible and highly specific but otherwise very useful) JavaScript components, and offering server-side support for requests made by such JavaScript components, Web client frameworks take more direct advantage of the dynamic capabilities of browser engines. Ways in which the full potential of browser engines can be realized are, for example, by compiling Python code into JavaScript or by embedding a Python interpreter into the Web browser itself. In some cases, Web browser engines can be run within separate customized applications rather than in a 'web browser' per se. See Web Browser Programming for details.

1.10. See Also

More information on python web frameworks can be found here:

Python Web Runner Free

  • TechEmpower - Web Framework Benchmarks - Round 19 - 2020-05-28

Other related wiki pages:

  • Implementations of the Web Server Gateway Interface

  • Web Servers and Python

  • Web Components

  • Web Programming in Python

  • Templating in Python

1.11. Editorial Note

The above lists should be arranged in ascending alphabetical order - please respect this when adding new solutions. When specifying release dates please use the format YYYY-MM-DD.

Some special notes to contributors to this page who like to assume an advocacy position when 'reorganizing' the content:

Python web runner free
  • Do not remove editorial guidelines: when people do this it not only indicates that they do not care about such guidelines, but it also leads others to believe that the page never had any structure or purpose.

  • If you must change the categories used on this page, at least attempt to assign all frameworks to meaningful categories. Do not invent special categories in order to elevate the profile of certain projects. Do not merge categories and put frameworks into a miscellaneous category.

  • Do not add links to projects unless they are Web frameworks. Instead, use the WebComponents, WebServers, Templating pages, or any page referenced by WebProgramming.

  • Some frameworks are not actively developed or maintained. Do not just move entries into the 'Discontinued/Inactive Frameworks' section without at least doing some investigation first.

  • Popular is a bit of an arbitrary classification. For something to be considered popular a good guideline would be that it is in the top 4000 packages as per Top PyPI Packages.

And some basic editing advice: use the preview button when making edits, rather than leaving tens of micro-changes in the history.