start new:
tmux
start new with session name:
tmux new -s myname
from flask import Flask, request, session, redirect, url_for | |
import urllib | |
import requests | |
app = Flask(__name__) | |
app.secret_key = 'iwonttellyou' | |
redirect_uri = 'http://localhost:5000/callback' | |
client_id = '' # get from https://code.google.com/apis/console | |
client_secret = '' |
#!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': |
# Based on https://github.com/sass/libsass/wiki/Building-with-autotools | |
# Install dependencies | |
apt-get install automake libtool | |
# Fetch sources | |
git clone https://github.com/sass/libsass.git | |
git clone https://github.com/sass/sassc.git libsass/sassc | |
# Create configure script |
ALSO SEE THIS: http://eddychan.com/post/18484749431/minimum-viable-ops-deploying-your-first-django-app-to | |
AND THIS: http://bitnami.com/stack/django | |
These are my notes on how to quickly setup a python, virtualenv (use virtualenv-burrito FTW), and django. | |
Setup an EC-2 instance: | |
======================= | |
Use the quick launch wizard: |
{% extends "admin/base_site.html" %} | |
{% load i18n admin_static admin_modify %} | |
{% load admin_urls %} | |
{% load url from future %} | |
{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %} | |
{% if not is_popup %} | |
{% block breadcrumbs %} | |
<ul> | |
<li><a href="{% url 'admin:index' %}">{% trans 'Home' %}</a></li> |
server { listen 80; | |
server_name example.com; | |
access_log /var/log/example.com/nginx.access.log; | |
error_log /var/log/example.com/nginx.error.log; | |
root /var/www/apps/example.com/public; | |
charset utf-8; | |
location / { | |
rewrite ^ https://$host$request_uri? permanent; | |
} |
#!/bin/bash | |
NAME="hello_app" # Name of the application | |
DJANGODIR=/webapps/hello_django/hello # Django project directory | |
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket | |
USER=hello # the user to run as | |
GROUP=webapps # the group to run as | |
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn | |
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use | |
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name |
As configured in my dotfiles.
start new:
tmux
start new with session name:
stage { "pre": before => Stage["main"] } | |
class python { | |
package { | |
"build-essential": ensure => latest; | |
"python": ensure => "2.6.6-2ubuntu1"; | |
"python-dev": ensure => "2.6.6-2ubuntu1"; | |
"python-setuptools": ensure => "latest"; | |
} | |
exec { "easy_install pip": | |
path => "/usr/local/bin:/usr/bin:/bin", |