Skip to content

Flask app for development + deployment of static sites. Includes bootstrap and S3 integration.

Notifications You must be signed in to change notification settings

mailbackwards/static-strap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

static-strap

static-strap is a Flask app skeleton that is optimized for rapid prototyping and deploying of static websites.

About

This app can be thought of as divided into two parts:

  • A static website generator inspired by this post and the magic of Frozen-Flask/Flask-FlatPages
  • An optional hook into an Amazon S3 account for easy command-line "deployment" of a static website (built on boto).

This allows for all the perks of a modern development framework (routes, templates, bootstrap, currently v.3.0.2), and even a pseudo-database. Good for personal webpages, hackathons, frontend playgrounds, etc.

Starting up

This is assuming virtualenv.

$ git clone https://github.com/mailbackwards/static-strap.git
$ cd static-strap
$ virtualenv .
$ . bin/activate
$ pip install -r requirements.txt
$ cp config.sample.py config.py
$ python manage.py runserver

This starts a local development server at localhost:5000. There's already a pair of sample bootstrapped pages to get started. Then run

$ python manage.py freeze

This generates a static site from the existing app, which puts a "frozen" version of it into the ./app/freezer directory; this directory can now be uploaded as a valid site to any server.

Deploying

To use the S3 deploy functionality, copy config.py from the root folder and fill in these variables:

S3_BUCKET_NAME = ''         # a new or existing (empty) bucket, usually your site's name
AWS_ACCESS_KEY_ID = ''      # your access key from Amazon
AWS_SECRET_ACCESS_KEY = ''  # your secret key from Amazon

Then close the file and run:

$ python manage.py deploy

to upload the folder containing the static site (whatever is in ./app/freezer) to the configured Amazon S3 bucket.

N.B.: This command deletes all existing files from the bucket before it deploys, so don't store any non-site-related files there.

Further reading

static-strap is built on:

I highly recommend Flask, it's a small (in a good way), powerful framework that seemed a perfect fit for making a small but powerful webpage. It's also written in the greatest language in the world.

Want list

  • More seamless testing framework for the static page (right now it's wonky as described here)
  • Git integration on deploy function

About

Flask app for development + deployment of static sites. Includes bootstrap and S3 integration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages