Package: elsa
elsaElsa will help you build yourFrozen-Flaskbased website and deploy it to GitHub pages.
It’s based on scripts fromPyLadies.cz repoand is distributed under the terms of the MIT license, see LICENSE (does not apply for the image below). It requires Python 3.Basic usageCreate you Flask app and give it toelsa.cli():fromflaskimportFlaskapp=Flask(...)# do stuff with appif__name__=='__main__':fromelsaimportclicli(app,base_url='https://example.com')This will add command line interface to the script, enabling you to use it like this:pythonfoo.pyserve# serves the site, no freezing, so you can check it quicklypythonfoo.pyfreeze# freezes the site, i.e. makes a HTML snapshotpythonfoo.pydeploy# deploys the frozen site to GitHub pagesSee more options with--help.Follow thequickstart tutorialfor more information.Travis CI based deploymentTravis 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 togh-pagesbranch in a single commit rewriting the history and all manual changes of that branch.Here is an example.travis.ymlfile for automatic deployment. It assumes elsa and other requirements are inrequirements.txtand that you are familiar with Travis CI (so it’s not very verbose):language:pythonpython:-'3.6'script:-'pythonfoo.pyfreeze'env:global:-secure:"blahblah"# gem install travis; travis encrypt GITHUB_TOKEN=xyz --adddeploy:provider:scriptskip_cleanup:truescript:'pythonfoo.pydeploy--no-freeze--push'on:branch:masterrepo:only/yoursTestingTo run the test suite, installtoxand run it:toxElsa uses pytest, so if you are familiar with it, feel free to run  it directly.Further notesURLsWhen you use URLs without trailing slash (e.g.https://example.com/foobar), GitHub pages would serve the pages with bad Content-Type header
(application/octet-streaminstead oftext/html) and the browser would attempt to download it.
That’s why Elsa will not allow such thing and will treatMimetypeMismatchWarningfrom Frozen-Flask as error.
Make sure to use URLs with trailing slash (e.g.https://example.com/foobar/) instead, so Frozen-Flask will createindex.htmlin a folder and GitHub pages will use proper content type.Changes0.1.6Add the--hostoption to CLI.
It corresponds toflask run’s--hostoption.When serving (withserveorfreeze--serve), Elsa now listens on
Flask’s default address,127.0.0.1. The server is not visible
externally.
Use--host=0.0.0.0to select the original, less secure behavior. (#67)0.1.5Add--verboseoption for the CLI. If used, it prints all frozen URLs
to standard error. Useful when freezing big projects on Travis CI. (#51)0.1.4Addinvoke_clioption for theclifunction.
If set toFalse, it only returns the cli for further extending. (#45)Don’t remove the remote tracking branch when--no-pushis used (fixes#41)Improve handling ofFrozenFlaskWarning(#37)Add the--show-git-push-stderroption to make deploy more verbose,
this can help debug problems, but is potentially dangerous, hence the output
ofgit pushis hidden by default. (#37)0.1.3Only treat Frozen-Flask warnings as errors, not other warnings (#34)Add a--remoteoption fordeployto use a custom git remoteBe consistent on local vs Travis CI deployment, always erase the history
of thegh-pagesbranch (actually fixes#14)0.1.2Security:Do not display the remote URL when pushing gh-pages branch.
If you used Elsa 0.1 or 0.1.1 on Travis CI, revoke your GitHub
token, it was probably leaked in the log. (#25)0.1.1Fix a problem with Travis CI based deployment0.1Add a test suiteTreat Frozen-Flask warnings as errorsImportant:It is now recommended to runfreezein.travis.ymlscriptsection to catch problems in Pull Requests etc.Important:This version of Elsa will warn if you use thedeploycommand without specifying--pushor--no-pushexplicitly.
In a future release, it will switch tonotpushing the built pages by
default.Remove the dependency onshto improve compatibility with WindowsSupports Linux, Mac OS X and WindowsThegh-branchis purged before the deploying commit (#14)It is possible to shutdown the server via a special POST request (#21)0.1.dev4Set template auto_reload flag directly in serve mode (#8)0.1.dev3Set TEMPLATES_AUTO_RELOAD by default (#5)Suppress a bogus warning about CNAME mime type (#7)0.1.dev2The CNAME route is now created automatically0.1.dev1Initial implementation fromPyLadies.cz