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=64c636d1e3ff35a7a1d3394fd1d3ff0093f44aa2;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" \
63 mv "$WRAPPER/"* "$WRAPPER/".gitignore .
66 chmod +x "$DJANGO_ROOT"/manage.py
67 mv "$DJANGO_ROOT/$PROJECT/localsettings.py.dev" "$DJANGO_ROOT/$PROJECT/localsettings.py"
69 echo -e "${strong}Installing requirements...${normal}"
70 pip install -r requirements.txt
71 echo -e "${strong}Installing developer requirements...${normal}"
72 pip install -r requirements-dev.txt
73 echo -e "${strong}Running syncdb...${normal}"
74 "$DJANGO_ROOT"/manage.py syncdb --noinput
76 echo -e "${strong}Starting new git repository...${normal}"
79 echo -e "${strong}What next?${normal}"
80 echo " * Work on your app, commit to git."
81 echo " * Review fabfile, use fab for deployment."