Steps with explanations to set up a server using:
- virtualenv
- Django
- nginx
- uwsgi
import os | |
from flask import Flask, render_template, request | |
import stripe | |
stripe_keys = { | |
'secret_key': os.environ['SECRET_KEY'], | |
'publishable_key': os.environ['PUBLISHABLE_KEY'] | |
} | |
stripe.api_key = stripe_keys['secret_key'] |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
<title>Stripe Getting Started Form</title> | |
<!-- The required Stripe lib --> | |
<script type="text/javascript" src="https://js.stripe.com/v2/"></script> | |
<!-- jQuery is used only for this example; it isn't required to use Stripe --> |
bash -c ' | |
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%> | |
yum install -y wget | |
wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>http://rbel.co/rbel5 | |
rpm -Uvh rbel5 | |
yum install -y rubygem-chef | |
' |
source ~/.git-completion.sh | |
alias gco='git co' | |
alias gci='git ci' | |
alias grb='git rb' | |
#!flask/bin/python | |
from flask import Flask, jsonify, abort, request, make_response, url_for | |
from flask.ext.httpauth import HTTPBasicAuth | |
app = Flask(__name__, static_url_path = "") | |
auth = HTTPBasicAuth() | |
@auth.get_password | |
def get_password(username): | |
if username == 'miguel': |
#!/bin/sh | |
# download this script | |
# make sure s3cmd is installed | |
# yum install s3cmd | |
# if yum mentioned above does not work then | |
# wget http://downloads.sourceforge.net/project/s3tools/s3cmd/1.5.0-alpha1/s3cmd-1.5.0-alpha1.tar.gz | |
# tar xvf s3cmd-1.5.0-alpha1.tar.gz | |
# cd s3cmd-1.5.0-alpha1 | |
# python setup.py install | |
# python 2.6+ is required |
#!/usr/bin/env bash | |
# file: ~/.virtualenvs/postmkvirtualenv | |
# This hook is run after a new virtualenv is activated. | |
# setup python interpretor and sitepackages | |
# for Sublime Text's SublimeCodeIntel plugin. | |
# codeintel looks in the root of any folder opened via `subl foldername` | |
# for foldername/.codeintel/config | |
# it also looks in ~/.codeintel/config |
jQuery(function($) { | |
$('form[data-async]').live('submit', function(event) { | |
var $form = $(this); | |
var $target = $($form.attr('data-target')); | |
$.ajax({ | |
type: $form.attr('method'), | |
url: $form.attr('action'), | |
data: $form.serialize(), |