Skip to content

Instantly share code, notes, and snippets.

View havencruise's full-sized avatar

Prashanth Padmanabh havencruise

View GitHub Profile
{
"dateranges": [
{
"start_date": "2015-01-29",
"end_date": "2015-02-19"
},
{
"start_date": "2015-02-11",
"end_date": "2015-02-12"
},
@havencruise
havencruise / setup_ec2_py27_mod_wsgi.sh
Last active June 9, 2018 01:55
Django + Python2.7 + Apache setup for AWS EC2 with mod_wsgi A how-to on setting up Python 2.7, Django and mod_wsgi, and using Python 2.7 with virtual_env(which is the right thing to do) on Amazon EC2 instances. .. .. .. Why? - Because Amazon EC2 instances usually come with Python 2.6 by default.
# You will need to run these with superuser permissions.
# Either prefix `sudo` to all commands, or switch user
# Be very careful when you switch user
sudo su - root
# Update all the packages
yum update
# Install the basics - python27, gcc, svn, git, httpd, make, uuid
@havencruise
havencruise / gist:4014709
Created November 5, 2012 01:22
Django - Custom decorator involving processing the request
# Django provides some great and easy to use decorators
# that accept simple functions that you could use to
# perform certain tests on the user. However, if your test
# depends on some parameter within the request object (like mine did),
# you could do something like:
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.utils.decorators import available_attrs
from django.utils.http import urlquote