Skip to content

grow/grow-ext-static-server

Repository files navigation

grow-ext-static-server

Master

A zero configuration, localization-aware static server that supports redirects designed to be used with Google App Engine.

Concept

Many static websites require limited dynamic functionality such as:

  • Vanity URL redirects
  • Trailing slash normalization
  • Localization (via redirects or rewriting responses)

This utility provides the above limited functionality in a zero-configuration manner, compatible with the podspec.yaml syntax for Grow websites and an additional redirect configuration file.

Usage

Grow setup

  1. Create an extensions.txt file within your pod.
  2. Add to the file: git+git://github.com/grow/grow-ext-static-server
  3. Run grow install.
  4. Add requirements.txt to the project root:
gunicorn
pyyaml
webapp2==3.0.0b1
  1. Add an app.yaml file to the project root:
# app.yaml
runtime: python37
entrypoint: gunicorn -b :$PORT -w 2 extensions.grow_static_server.main:app

handlers:
- url: (.*)
  script: auto
  secure: always
  1. Add a .gcloudignore file to the project root:
*
!/build/**
!/extensions/**
!/podspec.yaml
!/redirects.py
!/redirects.yaml
!/requirements.txt
!.

Configure and deploy

  1. Optionally add redirects, via redirects.yaml in the project root:
# redirects.yaml

redirects:
- ['/vanity-url', '/some-much-longer-destination-url']
- ['/test', 'https://example.com/']
- ['/test/:foo', 'https://example.com/$foo']

settings:
  custom_404_page: 404.html  # Path in 'build/' folder for custom 404 page.
  rewrite_localized_content: true  # Either true (default) or false.
  trailing_slash_behavior: add  # Either 'add' (default) or 'remove'.
  1. Deploy the application. See Makefile for example deployment commands.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published