5 # Make it a function, so that it works with `source`
8 DJANGO_REQ='Django>=1.5,<1.6'
10 PROJECT_TEMPLATE='http://git.nowoczesnapolska.org.pl/?p=fnpdjango.git;a=snapshot;h=8b4c794ea9a4783ad95f412925aa33e7b3da5375;sf=tgz'
11 VIRTUALENVWRAPPER_PATHS="
12 /etc/bash_completion.d/virtualenvwrapper
13 /usr/bin/virtualenvwrapper.sh
14 /usr/local/bin/virtualenvwrapper.sh
22 echo "Create new Django project."
23 while [ -z "$PROJECT" ]
25 echo "Name of the project:"
28 echo -e "Project: ${strong}${PROJECT}${normal}"
30 for venv in $VIRTUALENVWRAPPER_PATHS
34 VIRTUALENVWRAPPER="$venv"
38 if [ "$VIRTUALENVWRAPPER" ]
40 echo "virtualenvwrapper found at $VIRTUALENVWRAPPER."
41 source "$VIRTUALENVWRAPPER"
43 echo -e "${error}ERROR: virtualenvwrapper not found. Tried locations:${normal}"
44 echo "$VIRTUALENVWRAPPER_PATHS"
45 echo -e "${error}Install virtualenvwrapper or add the correct path to this script.${normal}"
50 echo -e "${strong}Creating virtualenv: $PROJECT...${normal}"
51 mkvirtualenv "$PROJECT"
52 echo -e "${strong}Installing Django...${normal}"
53 pip install "$DJANGO_REQ"
55 echo -e "${strong}Starting the project...${normal}"
56 django-admin.py startproject \
57 --template "$PROJECT_TEMPLATE" \
61 chmod +x "$DJANGO_ROOT"/manage.py
62 mv "$DJANGO_ROOT/$PROJECT/localsettings.py.dev "$DJANGO_ROOT/$PROJECT/localsettings.py
64 echo -e "${strong}Installing requirements...${normal}"
65 pip install -r requirements.txt
66 echo -e "${strong}Installing developer requirements...${normal}"
67 pip install -r requirements-dev.txt
68 echo -e "${strong}Running syncdb...${normal}"
69 "$DJANGO_ROOT"/manage.py syncdb --noinput
71 echo -e "${strong}Starting new git repository...${normal}"
74 echo -e "${strong}What next?${normal}"
75 echo " * Work on your app, commit to git."
76 echo " * Review fabfile, use fab for deployment."