#! /bin/sh # create and sanitise files for pushing to repo # Philip Sargent 2020/06/20 echo deprecations. python -Wall manage.py check -v 3 2>deprecations.txt >/dev/null echo diffsettings. python manage.py diffsettings | grep "###" > diffsettings.txt echo pip freeze. pip freeze > requirements.txt echo inspectdb. python manage.py inspectdb > troggle-inspectdb.py #egrep -in "unable|error" troggle-inspectdb.py echo remove passwords. cp localsettings.py localsettingsWSL.py grep EXPOUSERPASS localsettings*.py sed -i '/EXPOUSERPASS/ s/^.*$/EXPOUSERPASS = "nnn:gggggg"/' localsettings*.py sed -i '/EXPOUSERPASS/ s/^.*$/EXPOUSERPASS = "nnn:gggggg"/' diffsettings.txt echo " " reset: EXPOUSERPASS = \"nnn:gggggg\" grep EMAIL_HOST_PASSWORD localsettings*.py sed -i '/EMAIL_HOST_PASSWORD/ s/^.*$/EMAIL_HOST_PASSWORD = "insert-real-email-password-here"/' localsettings*.py sed -i '/EMAIL_HOST_PASSWORD/ s/^.*$/EMAIL_HOST_PASSWORD = "insert-real-email-password-here"/' diffsettings.txt echo " " reset: EMAIL_HOST_PASSWORD = \"insert-real-email-password-here\" grep SECRET_KEY *settings.* sed -i '/SECRET_KEY/ s/^.*$/SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"/' settings.py sed -i '/SECRET_KEY/ s/^.*$/SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"/' diffsettings.txt echo " " reset: SECRET_KEY = \"not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2\" # # Do these before final testing, *not* just before pushing: # python reset-django.py # python manage.py makemigrations # python manage.py test # python manage.py inspectdb > troggle-inspectdb.py # egrep -i "unable|error" troggle-inspectdb.py