Skip to content

Instantly share code, notes, and snippets.

@rg3915
Last active March 2, 2016 19:45
Show Gist options
  • Save rg3915/15b2100f3eeba362ebd8 to your computer and use it in GitHub Desktop.
Save rg3915/15b2100f3eeba362ebd8 to your computer and use it in GitHub Desktop.
Shell script to create a project to Django-CMS.
# Shell script to create a project to Django-CMS with Python 3.5
# Download:
# curl https://gist.githubusercontent.com/rg3915/15b2100f3eeba362ebd8/raw/27d1f1374f03e89bfc26648f08c35bc86eebc978/djangocms.sh -o djangocms.sh
# Usage:
# Type the following command, you can change the project name.
# source djangocms.sh
# Colors
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
echo "${green}>>> The name of the project is 'mydemo'.${reset}"
echo "${green}>>> Remove djangocms${reset}"
rm -rf djangocms
echo "${green}>>> Creating djangocms${reset}"
mkdir djangocms
cd djangocms
echo "${green}>>> Creating virtualenv${reset}"
python -m venv .venv
echo "${green}>>> .venv is created${reset}"
# active
sleep 2
echo "${green}>>> activate the .venv${reset}"
source .venv/bin/activate
PS1="(`basename \"$VIRTUAL_ENV\"`)\e[1;34m:/\W\e[00m$ "
sleep 2
# installdjango
echo "${green}>>> Installing the Django${reset}"
pip install -U pip
pip install djangocms-installer
pip freeze > requirements.txt
echo "${green}>>> Creating .gitignore${reset}"
cat << EOF > .gitignore
__pycache__/
*.py[cod]
*.sqlite3
*.env
*.DS_Store
.venv/
staticfiles/
.ipynb_checkpoints/
EOF
echo "${green}>>> Creating the app 'mydemo' ...${reset}"
djangocms -p . mydemo -s
echo "${green}>>> Done${reset}"
# https://www.gnu.org/software/sed/manual/sed.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment