Giter Club home page Giter Club logo

elsa's Introduction

elsa

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

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://sswebsolution.cf')

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.

Follow the quickstart tutorial for more information.

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):

Testing

To run the test suite, install tox and run it:

tox

Elsa uses pytest, so if you are familiar with it, feel free to run it directly.

Further notes

URLs

When 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-stream instead of text/html) and the browser would attempt to download it. That's why Elsa will not allow such thing and will treat MimetypeMismatchWarning from Frozen-Flask as error. 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.

elsa's People

Contributors

hroncok avatar encukou avatar mikicz avatar etellwen avatar sairon avatar p-cpu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.