Skip to main content

Helper module for Frozen-Flask based websites

Project description

Elsa will help you build your Frozen-Flask based website and deploy it to GitHub pages. It’s based on scripts from PyLadies.cz repo and is distributed under the terms of the MIT license, see LICENSE (does not apply for the image below). It requires Python 3.

Elsa

Image linked from cartoonbros.com, not stored in the repo, so the repo remains free.

Basic usage

Create you Flask app and give it to elsa.cli():

from flask import Flask

app = Flask(...)

# do stuff with app

if __name__ == '__main__':
    from elsa import cli
    cli(app, base_url='https://example.com')

This will add command line interface to the script, enabling you to use it like this:

python foo.py serve  # serves the site, no freezing, so you can check it quickly
python foo.py freeze  # freezes the site, i.e. makes a HTML snapshot
python foo.py deploy  # deploys the frozen site to GitHub pages

See more options with --help.

Travis CI based deployment

Travis CI is (in this context) a tool, that allows you to deploy the site automatically to GitHub pages after every push. All you have to do is tell Travis to run Elsa and provide a GitHub token. Elsa on Travis will freeze the site and deploy it frozen to GitHub pages. Elsa knows it’s being run on Travis and will use the provided GitHub token to gain push permissions. Elsa will push force to gh-pages branch in a single commit rewriting the history and all manual changes of that branch.

Here is an example .travis.yml file for automatic deployment. It assumes elsa and other requirements are in requirements.txt and that you are familiar with Travis CI (so it’s not very verbose):

language: python
python:
    - '3.5'
script:
    - "echo 'No linters, no tests...'"
env:
  global:
    - secure: "blahblah"  # gem install travis; travis encrypt GITHUB_TOKEN=xyz --add
deploy:
    provider: script
    script: 'python foo.py deploy'
    on:
        branch: master
        repo: only/yours

Further notes

URLs

When you use URLs without trailing slash (e.g. https://example.com/foobar), GitHub pages will serve the pages with bad Content-Type header (application/octet-stream instead of text/html) and the browser will attempt to download it. Make sure to use URLs with trailing slash (e.g. https://example.com/foobar/) instead, so Frozen-Flask will create index.html in a folder and GitHub pages will use proper content type.

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

elsa-0.1.dev4.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elsa-0.1.dev4-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file elsa-0.1.dev4.tar.gz.

File metadata

  • Download URL: elsa-0.1.dev4.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for elsa-0.1.dev4.tar.gz
Algorithm Hash digest
SHA256 5e238e7cc56d5427c77bac635be5b08ca2a2a8cb7bf455137cab07fc93386cbd
MD5 71f72fe16ad165f3076e76992a362189
BLAKE2b-256 e4cde7978ba517321fcc7356d29c94cebec9c45eaf65619448d1f7da549b33cc

See more details on using hashes here.

File details

Details for the file elsa-0.1.dev4-py3-none-any.whl.

File metadata

File hashes

Hashes for elsa-0.1.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 fa74c00d07fd9310fddbb7faacf93be0a297b7f7c9e910bbc73753b7799010ed
MD5 57407ed24b639fa9f3302f97bc183b59
BLAKE2b-256 3632ec2e2ab201dc779ccb92a300a42297760a78268038a3cf19bc4ddfae1cdd

See more details on using hashes here.

Supported by

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