Python Makefile
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
docs
sappy
tests
.appveyor.yml
.coveragerc
.gitattributes
.gitignore
.pycodestyle.ini
.pydocstyle.ini
.pylint.ini
.scrutinizer.yml
.travis.yml
.verchew.ini
CHANGELOG.md
CONTRIBUTING.md
LICENSE.md
MANIFEST.in
Makefile
Pipfile
Pipfile.lock
README.md
mkdocs.yml
requirements.txt
scent.py
setup.py

README.md

Unix: Unix Build Status Windows: Windows Build Status
Metrics: Coverage Status Scrutinizer Code Quality
Usage: 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: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.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