Skip to content

Instantly share code, notes, and snippets.

@lcfd
Last active February 19, 2019 16:55
Show Gist options
  • Save lcfd/c1e561715a62ef570e54d3472e490b87 to your computer and use it in GitHub Desktop.
Save lcfd/c1e561715a62ef570e54d3472e490b87 to your computer and use it in GitHub Desktop.
Create a Django project with just one command.
#!/usr/bin/env bash
echo "
██████╗ ██╗ █████╗ ███╗ ██╗ ██████╗ ██████╗ ██████╗
██╔══██╗ ██║██╔══██╗████╗ ██║██╔════╝ ██╔═══██╗██╔══██╗
██║ ██║ ██║███████║██╔██╗ ██║██║ ███╗██║ ██║██████╔╝
██║ ██║██ ██║██╔══██║██║╚██╗██║██║ ██║██║ ██║██╔══██╗
██████╔╝╚█████╔╝██║ ██║██║ ╚████║╚██████╔╝╚██████╔╝██║ ██║
╚═════╝ ╚════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
Django project creator since 2019
"
# Optional first parameter
ARG1=${1:-foobar}
echo "Create new folder $ARG1"
mkdir $ARG1
echo "Enter in $ARG1 folder"
cd $ARG1
echo "Create python3 virtual env"
python3 -m venv env
echo "Activate the virtual env"
source ./env/bin/activate
echo "Install Django usefull stuff"
pip install --upgrade pip
pip install django
pip install djangorestframework
pip install djangorestframework_simplejwt
echo "Create the project"
django-admin startproject project
# Go inside project folder
cd project
echo "Create main app"
python manage.py startapp main
# Go back to main folder
cd ..
echo "Freeze dependencies"
pip freeze > requirements.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment