This article is now published on my website: Prefer Subshells for Context.
#!/usr/bin/python | |
# coding=utf-8 | |
# Python version of Zach Holman's "spark" | |
# https://github.com/holman/spark | |
# by Stefan van der Walt <[email protected]> | |
""" | |
USAGE: |
#!/bin/bash | |
# virtualenv-auto-activate.sh | |
# | |
# Installation: | |
# Add this line to your .bashrc or .bash-profile: | |
# | |
# source /path/to/virtualenv-auto-activate.sh | |
# | |
# Go to your project folder, run "virtualenv .venv", so your project folder | |
# has a .venv folder at the top level, next to your version control directory. |
''' | |
Warning! Your mileage may vary | |
Based on: | |
- Read this for EC2 setup info and the approach - http://www.dikant.de/2010/10/08/setting-up-a-vpn-server-on-amazon-ec2/ | |
- https://gist.github.com/1130401 | |
- EC2 fabric bits via - https://github.com/slacy/fabric-ec2 | |
''' |
# list_detail.object_list replacement with all the things I need | |
def object_list(request, queryset, extra_context=None, | |
template_name='', paginate_by=None): | |
class ObjectList(ListView): | |
def post(self, request, *args, **kwargs): | |
return self.get(request, *args, **kwargs) | |
def get_context_data(self, **kwargs): | |
c = super(ObjectList, self).get_context_data(**kwargs) |
web: gunicorn -w4 -b0.0.0.0:$PORT app:app |
It appears that Apple somehow broke Python in Mountain Lion, so even with the latest Command Line Tools and Xcode 4.4 virtualenv won't properly work. During virtual environment creation it will try to install easy_install inside /Library hierarchy. So let's give it a quick workaround. Let's install custom python into your $HOME-directory using pythonbrew!
Without the Apple Mac Developer account you won't even see the proper download link for the latest CL Tools and the old one won't work on ML. So here's the link: http://goo.gl/iBTXh. It points towards the Apple website so don't worry.
include: | |
- pil | |
apache2: | |
pkg: | |
- installed | |
build-essential: | |
pkg.installed |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
from urlparse import urlsplit, urlunsplit | |
from storages.backends.s3boto import S3BotoStorage | |
class ProtocolRelativeS3BotoStorage(S3BotoStorage): | |
"""Extends S3BotoStorage to return protocol-relative URLs | |
See: http://paulirish.com/2010/the-protocol-relative-url/ | |
""" |