Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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

Project Description

Unix: Windows: Metrics: Usage:

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:1234/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.5+

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

Revision History

1.1 (2017/03/21)

  • Added handling of HTML pages without the extension.

1.0.1 (2017/03/21)

  • Fixed handling of relative paths in assets.

1.0 (2017/01/09)

  • Initial stable release.

0.2 (2016/06/09)

  • Added a --launch option to open the page’s index.

0.1 (2016/06/09)

  • Initial release.
Release History

Release History

This version
History Node

1.1

History Node

1.0.1

History Node

1.0

History Node

0.2.1

History Node

0.2

History Node

0.1

History Node

0.0.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
sappy-1.1-py3-none-any.whl (9.6 kB) Copy SHA256 Checksum SHA256 py3 Wheel Mar 21, 2017
sappy-1.1.tar.gz (7.9 kB) Copy SHA256 Checksum SHA256 Source Mar 21, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting