Skip to content

Instantly share code, notes, and snippets.

View clemesha's full-sized avatar

Alex Clemesha clemesha

View GitHub Profile
@clemesha
clemesha / flaskapp.py
Created June 11, 2012 09:21 — forked from kennethreitz/flaskapp.py
My typical flask app base
# -*- coding: utf-8 -*-
import os
from flask import Flask
from flask_heroku import Heroku
from flask_sslify import SSLify
from raven.contrib.flask import Sentry
from flask.ext.celery import Celery
ACCESS_KEY='YOUR AMAZON API KEY'
SECRET='YOUR AMAZON SECRET'
BUCKET_NAME='database_backup_bucket' #note that you need to create this bucket first
from boto.s3.connection import S3Connection
from boto.s3.key import Key
def save_file_in_s3(filename):
conn = S3Connection(ACCESS_KEY, SECRET)
bucket = conn.get_bucket(BUCKET_NAME)
"""
'How to do basic authentication on twisted web', from here:
http://twistedmatrix.com/pipermail/twisted-python/2009-August/020236.html
Original Copyright (c) 2008 Twisted Matrix Laboratories. See LICENSE for details.
Which I modified to use Twisted's Application framework.
USAGE
-----
1) Make htpasswd file: