Skip to main content

Single-page application server for end-to-end testing.

Project description

Unix Build Status Windows Build Status Coverage Status Scrutinizer Code Quality PyPI Version

Overview

Sappy is a simple, single-page application (SPA) web server for end-to-end testing.

The Python standard library includes a web server that works great for serving up files:

$ python3 -m http.server 8080
Serving HTTP on 0.0.0.0 port 8080 ...

$ curl http://localhost:8080/index.html
<!DOCTYPE html>
<html>
  <head>
    <title>Example Index</title>
...

But when used to serve up single-page applications, a 404 is returned whenever any page other than the index is accessed directly:

$ curl http://localhost:8080/login
<!DOCTYPE html>
<html lang=en>
  <title>Error 404 (Not Found)</title
...

This project builds on the existing web server code to forward all requests to the index. The single-page application’s client-side routing can then display the page that corresponds to that request’s URL.

Setup

Requirements

  • Python 3.6+

Installation

Install sappy with pip:

$ pip install sappy

or directly from the source code:

$ git clone https://github.com/jacebrowning/sappy.git
$ cd sappy
$ python setup.py install

Usage

Build your static website (e.g. an Ember application) for production:

$ ember build --environment=production
Building...
Built project successfully. Stored in "dist/".

Then serve up the application:

$ sappy
Serving /home/browning/project/dist/ on 8080

Check out the documentation or command-line help for additional options:

$ sappy --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sappy-1.2b1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

sappy-1.2b1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file sappy-1.2b1.tar.gz.

File metadata

  • Download URL: sappy-1.2b1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.9.0 Darwin/20.3.0

File hashes

Hashes for sappy-1.2b1.tar.gz
Algorithm Hash digest
SHA256 607267b4fbb3fea93c1b930d7cc2a3628aa6990373f83e5260215f23dac3e090
MD5 f759525d5ca2517610012e5080b2735a
BLAKE2b-256 3c9ab911b37d5bae6457d88ebfc61bb5b4bce7a59e0345e2b5354b6f7a9e5797

See more details on using hashes here.

File details

Details for the file sappy-1.2b1-py3-none-any.whl.

File metadata

  • Download URL: sappy-1.2b1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.9.0 Darwin/20.3.0

File hashes

Hashes for sappy-1.2b1-py3-none-any.whl
Algorithm Hash digest
SHA256 62266871a9f9b3429b6682203e0f55054e38eea5f511f813495a935bd5b7f842
MD5 2264c803d8cd4df5fd68d57ae2a98f1e
BLAKE2b-256 774a526292015e69b17bd9be1d92204f36cc578429349186c085ac2288eb56b1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page