Created
August 31, 2011 09:09
-
-
Save sammyrulez/1183132 to your computer and use it in GitHub Desktop.
script to create a django project bound to gondor.io deploy
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 | |
if [ $# -ne 2 ] | |
then | |
echo "Error in $0 - Invalid Argument Count" | |
echo "Syntax: $0 project_name gondor_app_id" | |
exit | |
fi | |
project_name=$1 | |
gondor_id=$2 | |
project_name_prj=$1'_prj' | |
mkdir $project_name_prj | |
cd $project_name_prj | |
hg init | |
django-admin.py startproject $project_name | |
cd $project_name | |
echo "Django==1.3" > requirements.txt | |
echo "psycopg2" >> requirements.txt | |
echo gondor==1.0b1.post14 >> requirements.txt | |
echo "south" >> requirements.txt | |
echo '# --- DEVELOPMENT REQUIREMENTS ! ---' > requirements_dev.txt | |
echo coverage >> requirements_dev.txt | |
echo django-jenkins >> requirements_dev.txt | |
cd .. | |
virtualenv $project_name'_py_env' | |
source $project_name'_py_env'/bin/activate | |
cd $project_name | |
pip install -r requirements.txt | |
pip install -r requirements_dev.txt | |
echo import os, sys > wsgi.py | |
echo >> wsgi.py | |
echo 'sys.path.insert(0, os.path.abspath(os.path.join(os.path.abspath(os.path.dirname(__file__)), os.pardir)))' >> wsgi.py | |
echo 'sys.path.insert(0, os.path.abspath(os.path.join(os.path.abspath(os.path.dirname(__file__)))))' >> wsgi.py | |
echo >> wsgi.py | |
echo from django.core.handlers.wsgi import WSGIHandler >> wsgi.py | |
echo 'os.environ[\"DJANGO_SETTINGS_MODULE\"] = "'$project_name'.settings"' >> wsgi.py | |
echo 'application = WSGIHandler()' >> wsgi.py | |
echo 'try:' >> settings.py | |
echo ' from local_settings import *' >> settings.py | |
echo 'except ImportError:' >> settings.py | |
echo ' pass '>> settings.py | |
gondor init $gondor_id | |
sed -i 's/migrations = none/migrations = south/g' .gondor/config | |
cd .. | |
echo 'syntax: glob' > .hgignore | |
echo '*.elc' >> .hgignore | |
echo '*.pyc' >> .hgignore | |
echo '*.pyo' >> .hgignore | |
echo '*~' >> .hgignore | |
echo '*.db' >> .hgignore | |
echo 'local_settings.py' >> .hgignore | |
echo '# switch to regexp syntax.' >> .hgignore | |
echo 'syntax: regexp'>> .hgignore | |
echo '^\\'$project_name'_py_env/'>> .hgignore | |
cd $project_name | |
hg add *.py | |
hg add *.txt | |
hg add .gondor/config | |
hg commit -m 'init' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment