This repo is a collection of scripts that can be used to automate processes in django
$ svn export https://github.com/bglynch/automate-django-bash-scripting/trunk/scripts
This imports a directory name 'scripts' which holds the script files
scripts/a-up-and-running.sh
- installs django 2
- creates project
- adds run and PROJECTNAME to bash_alias
- adds user to ALLOWED_HOSTS in settings.py
- adds local database to .gitignore
$ bash scripts/a-up-and-running.sh <projectname>
Note: must adhere to django project naming conventions - ie no spaces
Test it worked
First close and then reopen the terminal
$ run
Open new tab on port 8080 and should see the following screen
scripts/b-superuser-migrate.sh
- initial migrate
- creates superuser
$ bash scripts/b-superuser-migrate.sh
Test it worked
Open the app and add /admin to the end of the URL
Login using the username and password create when adding superuser
Should see the following screen
scripts/c-static-files.sh
- create static directory
- populate directory with ./static/css/style.css
- populate directory with ./static/js/custom.js
- populate directory with ./static/images
- creates templates directory
- populate directory with ./templates/base.html
- add path to ./templates to settings.py
$ bash scripts/c-static-files.sh
scripts/d-media.sh
- create media directory
- install Pillow
- add media context processor to settings.py
- add MEDIA_URL and MEDIA_ROOT to base of settings.py
$ bash scripts/d-media.sh