Skip to content

Instantly share code, notes, and snippets.

@biern
Created August 5, 2011 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save biern/1128729 to your computer and use it in GitHub Desktop.
Save biern/1128729 to your computer and use it in GitHub Desktop.
alwaysdata config
export PYTHONPATH=~/modules/
export PATH=~/modules/bin:~/modules/:$PATH
export WORKON_HOME=$HOME/.virtualenvs
source ~/modules/virtualenvwrapper.sh
export PIP_REQUIRE_VIRTUALENV=true
export PIP_RESPECT_VIRTUALENV=true
export PIP_VIRTUALENV_BASE=$WORKON_HOME
# source .bash_profile
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L]
#!/home/biern/marcinbiernat.pl/env/bin/python
# NOTE: Remember to change shebang when changing _ENV_DIR !
_PROJECT_NAME = 'biern'
_ROOT_DIR = '/home/biern/marcinbiernat.pl/'
_PROJECT_DIR = os.path.join(_ROOT_DIR, _PROJECT_NAME)
_ENV_DIR = os.path.join(_ROOT_DIR, 'env')
import os, sys
# Setup virtualenv, path, etc
os.environ.setdefault('PATH', '/bin:/usr/bin')
os.environ['PATH'] = os.path.join(_ENV_DIR, 'bin:') + os.environ['PATH']
os.environ['VIRTUAL_ENV'] = _ENV_DIR
os.environ['PYTHON_EGG_CACHE'] = os.path.join(_ENV_DIR, 'egg_cache')
# Project path
sys.path.insert(0, _PROJECT_DIR)
# Django settings
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method='threaded', daemonize='false')
mkdir ~/modules
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
# http://wiki.alwaysdata.com/wiki/Deploying_a_Django_App
git clone git://github.com/biern/marcinbiernat.pl.git
cd marcinbiernat.pl
mkdir public
# insert django.fcgi and .htaccess here
# create virtualenv
virtualenv env # don't use --no-site-packages - use provided django version
source env/bin/activate
pip install (what is needed)
# configure django settings (db access and such)
./biern/manage.py syncdb # and migrate if needed
# link static dirs to public/
# configure domain from admin panel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment