Skip to content

Instantly share code, notes, and snippets.

@davidbgk
Created December 18, 2013 09:33
Show Gist options
  • Select an option

  • Save davidbgk/8019652 to your computer and use it in GitHub Desktop.

Select an option

Save davidbgk/8019652 to your computer and use it in GitHub Desktop.
## log via ssh
mkdir modules
## add modules to python path in your .bash_profile
#export PYTHONPATH=~/modules/
# source .bash_profile
## install pip & virtualenv
easy_install-2.6 --install-dir ~/modules -U pip
easy_install-2.6 --install-dir ~/modules -U virtualenv
easy_install-2.6 --install-dir ~/modules -U virtualenvwrapper
## add this to .bash_profile
#export PATH=$HOME/modules/bin:$HOME/modules/:$PATH
#export WORKON_HOME=$HOME/.virtualenvs
#source $HOME/modules/virtualenvwrapper.sh
#export PIP_REQUIRE_VIRTUALENV=true
#export PIP_RESPECT_VIRTUALENV=true
#export PIP_VIRTUALENV_BASE=$WORKON_HOME
# source .bash_profile
## Create virtual env
mkvirtualenv --no-site-packages myenv
## Install some modules
#pip install Django
#pip install MySQL-python
#pip install PIL
## Change django.fcgi file
#!/usr/bin/python
# Set up virtualenv
venv = '/home/px/.virtualenvs/myenv/bin/activate_this.py'
execfile(venv, dict(__file__=venv))
import os, sys
_PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, _PROJECT_DIR)
sys.path.insert(0, os.path.dirname(_PROJECT_DIR))
_PROJECT_NAME = _PROJECT_DIR.split('/')[-1]
os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings" % _PROJECT_NAME
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment