5 # source <(curl d.nowoczesnapolska.org.pl)
11 # Make it a function, so that it works with `source`
14 DJANGO_REQ='Django>=1.6,<1.7'
17 PYPI='http://pypi.nowoczesnapolska.org.pl/simple'
18 PROJECT_TEMPLATE='http://git.nowoczesnapolska.org.pl/?p=fnpdjango.git;a=snapshot;h=95e41c888d219481622111ea0cd7f59b7c47b625;sf=tgz'
20 VIRTUALENVWRAPPER_PATHS="
21 /etc/bash_completion.d/virtualenvwrapper
22 /usr/bin/virtualenvwrapper.sh
23 /usr/local/bin/virtualenvwrapper.sh
31 echo "Create new Django project."
32 while [ -z "$PROJECT" ]
34 echo "Name of the project:"
37 echo -e "Project: ${strong}${PROJECT}${normal}"
39 for venv in $VIRTUALENVWRAPPER_PATHS
43 VIRTUALENVWRAPPER="$venv"
47 if [ "$VIRTUALENVWRAPPER" ]
49 echo "virtualenvwrapper found at $VIRTUALENVWRAPPER."
50 source "$VIRTUALENVWRAPPER"
52 echo -e "${error}ERROR: virtualenvwrapper not found. Tried locations:${normal}"
53 echo "$VIRTUALENVWRAPPER_PATHS"
54 echo -e "${error}Install virtualenvwrapper or add the correct path to this script.${normal}"
59 echo -e "${strong}Creating virtualenv: $PROJECT...${normal}"
60 mkvirtualenv "$PROJECT"
61 echo -e "${strong}Installing Django...${normal}"
62 pip install -i "$PYPI" "$DJANGO_REQ"
63 pip install -i "$PYPI" --pre django-startproject-plus
65 echo -e "${strong}Starting the project...${normal}"
66 django-startproject.py \
67 --template "$PROJECT_TEMPLATE" \
69 --extra_context='{"year": "`date +%Y`"}' \
74 # GitWeb adds a top directory to the snapshot, let's remove it.
75 if [ ! -e .gitignore ]
78 mv "$WRAPPER/"* "$WRAPPER/".gitignore .
82 chmod +x "$DJANGO_ROOT"/manage.py
83 mv "$DJANGO_ROOT/$PROJECT/localsettings.py.dev" "$DJANGO_ROOT/$PROJECT/localsettings.py"
85 echo -e "${strong}Installing requirements...${normal}"
86 pip install -i "$PYPI" -r requirements.txt
87 echo -e "${strong}Installing developer requirements...${normal}"
88 pip install -i "$PYPI" -r requirements-dev.txt
89 echo -e "${strong}Running syncdb...${normal}"
90 "$DJANGO_ROOT"/manage.py syncdb --noinput
92 echo -e "${strong}Starting new git repository...${normal}"
95 echo -e "${strong}What next?${normal}"
96 echo " * Work on your app, commit to git."
97 echo " * Review fabfile, use fab for deployment."
103 # The following is just for displaying it as a webpage:<!--
104 #--><style>body{white-space:pre;color:#ddd}</style><h1 style="color:#000;text-align:center;position:fixed;top:0;bottom:0;left:0;right:0;white-space:normal">source <(curl <span id="location"></span>)</h1><script>document.getElementById('location').innerHTML=window.location;</script>