Skip to content

Instantly share code, notes, and snippets.

@roberto-butti
Last active August 29, 2015 14:14
Show Gist options
  • Save roberto-butti/ad155147fe2bd9461964 to your computer and use it in GitHub Desktop.
Save roberto-butti/ad155147fe2bd9461964 to your computer and use it in GitHub Desktop.
My script for installing new Django project with virtualenv
PROJECTNAME=example
APPNAME=${PROJECTNAME}app
PROJECTDIR=${PROJECTNAME}_project
ENVNAME=${PROJECTNAME}env
SITENAME=${PROJECTNAME}sitename
echo "I will create ${PROJECTDIR} for${PROJECTNAME}"
mkdir ${PROJECTDIR}
cd ${PROJECTDIR}
echo "ok i'm in: " $(pwd)
touch .gitignore
echo "${PROJECTNAME} django project" >> readme.md
virtualenv --no-site-packages ${ENVNAME}
source ./${ENVNAME}/bin/activate
pip install Django
which django-admin.py
django-admin.py startproject ${SITENAME}
cd ${SITENAME}
python manage.py startapp ${APPNAME}
#find . -type d
cd ../..
deactivate
cat << HELPTXT
I created a ${PROJECTDIR}.
Now you can
cd ${PROJECTDIR}
Here you can find:
- your ${ENVNAME} environment
- a .gitignore file
- a readme.md file
- your project directory ${SITENAME}
- Your manage.py is under ${PROJECTDIR}/${SITENAME}
- Your app is under ${PROJECTDIR}/${SITENAME}/${APPNAME}
- Your project settings ${PROJECTDIR}/${SITENAME}/${SITENAME}
HELPTXT
echo "PROJECT DIRECTORY ${PROJECTDIR}"
ls ${PROJECTDIR}
echo "SOURCE DIRECTORY ${PROJECTDIR}/${SITENAME}"
ls ${PROJECTDIR}/${SITENAME}
echo "APP DIRECTORY ${PROJECTDIR}/${SITENAME}/${APPNAME}"
ls ${PROJECTDIR}/${SITENAME}/${APPNAME}
echo "PROJECT SETTINGS ARE IN ${PROJECTDIR}/${SITENAME}/${SITENAME}"
ls ${PROJECTDIR}/${SITENAME}/${SITENAME}
echo "Done"
@enrike1983
Copy link

well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment