Created
June 30, 2013 08:31
-
-
Save maksudc/5894366 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This deploy hook gets executed after dependencies are resolved and the | |
# build hook has been run but before the application has been started back | |
# up again. This script gets executed directly, so it could be python, php, | |
# ruby, etc. | |
#todo: get python version | |
# This is not correct -- will return python-2.6 | |
# cartridge_type=`python -c "import sys; print(''.join(['python-','.'.join(map(str,sys.version_info[:2]))]))"` | |
cartridge_type="python-2.7" | |
source $OPENSHIFT_HOMEDIR/$cartridge_type/activate_virtenv | |
pip install Django==1.5 | |
# Link to admin css+js files. There's probably a right 'Django' way of | |
# doing this w/ collectstatic. I ain't Django literate and I don't think | |
# I wanna be either - if serving static files is so cumbersome. | |
ln -sf "$OPENSHIFT_HOMEDIR/$cartridge_type/virtenv/lib/python2.7/site-packages/Django-1.5-py2.7.egg/django/contrib/admin" "$OPENSHIFT_REPO_DIR"wsgi/static/ | |
if [ ! -f $OPENSHIFT_DATA_DIR/sqlite3.db ] | |
then | |
echo "Copying $OPENSHIFT_REPO_DIR/wsgi/openshift/sqlite3.db to $OPENSHIFT_DATA_DIR" | |
cp "$OPENSHIFT_REPO_DIR"wsgi/openshift/sqlite3.db $OPENSHIFT_DATA_DIR | |
python "$OPENSHIFT_REPO_DIR".openshift/action_hooks/secure_db.py | tee ${OPENSHIFT_DATA_DIR}/CREDENTIALS | |
#else | |
echo "Executing 'python $OPENSHIFT_REPO_DIR/wsgi/openshift/manage.py syncdb --noinput'" | |
python "$OPENSHIFT_REPO_DIR"wsgi/openshift/manage.py syncdb --noinput | |
fi | |
echo "Executing 'python $OPENSHIFT_REPO_DIRwsgi/openshift/manage.py collectstatic --noinput'" | |
python "$OPENSHIFT_REPO_DIR"wsgi/openshift/manage.py collectstatic --noinput |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment