⚠ This post is fairly old. I don't keep it up to date. Be sure to see comments where some people have posted updates
What this will cover
- Host a static website at S3
- Redirect
www.website.com
towebsite.com
- Website can be an SPA (requiring all requests to return
index.html
) - Free AWS SSL certs
- Deployment with CDN invalidation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Inspired by http://flask.pocoo.org/snippets/40/ """ | |
app = Flask(__name__) | |
@app.url_defaults | |
def hashed_url_for_static_file(endpoint, values): | |
if 'static' == endpoint or endpoint.endswith('.static'): | |
filename = values.get('filename') | |
if filename: | |
if '.' in endpoint: # has higher priority |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
""" | |
This script automates the task of connecting to a running App Engine server, | |
whether it's a local dev_appserver or a live app. | |
If PyQt4 is installed, it will ask for credentials inside a dialog box | |
instead of prompting in the terminal. This is good for shells that do | |
not support getpass (iPython). | |
It will automatically add an import path for a local virtualenv in the app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
AppStats serializer module which converts App Engine profile data from Protocol Buffers into JSON. | |
Usage: | |
import appstats_serializer | |
# List all AppStats summaries: | |
appstats_dicts = appstats_serializer.appstats_to_dict(summaries_only=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import | |
import datetime | |
from ndb import model | |
from webapp2_extends.utils import Unique, UniqueConstraintViolation, \ | |
check_password_hash, generate_password_hash | |
from webapp2_extends.auth import create_session_id | |
DEBUG = True |