Skip to content

Instantly share code, notes, and snippets.

@sputnikus
Created June 8, 2011 15:20
Show Gist options
  • Save sputnikus/1014627 to your computer and use it in GitHub Desktop.
Save sputnikus/1014627 to your computer and use it in GitHub Desktop.
Deployment process on OpenShift
# generic install and usage of rhc
# install rhc gem
export RB_USER_INSTALL=true
export PATH=$PATH:/home/holly/.gem/ruby/1.8/bin
gem install --user-install --source http://gems.rubyforge.org --source https://openshift.redhat.com/app/repo/ rhc
# json-1.5.1
# parseconfig-0.5.2
# rhc-0.69.3
gem install --user-install iconv -- --with-opt-dir=/usr/local
# create domain
rhc-create-domain -n <domain name> -l <login email>
# create wsgi app
rhc-create-app -a <app name> -t wsgi-3.2.1
# development
cd <app directory>
virtualenv --no-site-packages --distribute env
# if you are using python 2.7, you'll need
cd env/lib/
ln -s python2.7 python2.6
source env/bin/activate
# lets describe flask deployment
git clone http://github.com/mitsuhiko/flask.git
cd flask
python setup.py install
cd ..
rm -rf flask
cd libs
mkdir application
mkdir application/statics
mkdir application/templates
# write application logic
vim application/__init__.py
# put your templates and statics into corresponding directories
# now wsgi frontend script
# rhc demand on file name application
cd <app root>/wsgi
rm application
cat > application
#!/usr/bin/env python
import os
import sys
here = os.path.dirname(os.path.abspath(__file__))
flaskapp = os.path.join(here, "../libs")
activate = os.path.join(here, "../data/env/bin/activate_this.py")
pythoneggs = os.path.join(here, "../data/python-eggs")
sys.path.insert(0, flaskapp)
execfile(activate, dict(__file__=activate))
os.environ["PYTHON_EGG_CACHE"] = pythoneggs
from application import app as application
EOF
cd <app root>
cat > .gitignore
*.pyc
*.org
*.bak
*.old
*.sw[po]
EOF
git add .
git commit -m "first flask app"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment