Skip to main content

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

Project description

Unix: Unix Build Status Windows: Windows Build StatusMetrics: Coverage Status Scrutinizer Code QualityUsage: PyPI Version PyPI Downloads

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 (unreleased)

  • Added basic authentication support via SAPPY_BASIC_AUTH.

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.

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.1b1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

sappy-1.1b1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sappy-1.1b1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sappy-1.1b1.tar.gz
Algorithm Hash digest
SHA256 d52f3ae74b9edbe83fccca94e734f87c5520e745fe9f702c402b8c0a8130481d
MD5 ede1018d07c3f2c4f52304faf9c49e7b
BLAKE2b-256 2942966fe14ef1af91d16835fa5d54e3e2076079378bb66e90260c8efca8aa88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sappy-1.1b1-py3-none-any.whl
Algorithm Hash digest
SHA256 46567339c51f91590288c7f1e8689d1b91cfb49ca9b0b1b77ee8f0bebdf358de
MD5 6471e093c8e856c91d511be042f8bd44
BLAKE2b-256 a6c95faf57ee08dd651fbc2c9d06a5c151b61bd67ca5e05a635c536d89309700

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