

If there's an existing installation: ------------------------------------------------------------------------------------------------
1) Backup, recursively, ideatree parent directory.
2) Backup the database.
3) Wipe clean the 'mysite/static/* directories, NOT THE mysite/ideatree/static/* DIRECTORIES!

HELPFUL IF YOU GET SIDEWAYS WTIH GIT:
https://www.howtogeek.com/devops/how-to-completely-reset-a-git-repository-including-untracked-files/

STARTING UP: --------------------------------------------------------------------------------------------------
1) IMPORTANT!!!!!!:  Search for "DEVEL" and toggle comments to go between development environment and production:
a) git "DEVEL" * -r > temp.txt
a) vim temp.txt and comment all lines marked "DEVEL"

2) On the server:
a) Activate the virtual environment:  from /mysite, run 'source ./activateVenv'

If an ideatree database already exists, instead of these two, do what's found at:
https://stackoverflow.com/questions/29888046/django-1-8-create-initial-migrations-for-existing-schema
You may have to comment out the changes in models.py that differ from the existing database, run the makemigrations step,
then uncomment and run makemigrations again.
Otherwise, do:
c) run:  'python manage.py makemigrations ideatree'
d) run:  'python manage.py migrate ideatree'

Then,
e) run:  'python manage.py collectstatic' 
f) run: 'apt install libpq-dev'
g) run:  'pip install -r /path/to/requirements.txt'
h) Type 'deactivate' to leave the virtual environment.
NOTE: depending on file permissions, you may have to do the above as root.

3) run: sudo service apache2 restart

4) All the map output directories have to be deleted.  BE CAREFUL.
a) cd /var/www/mysite/ideatree/templates/ideatree/output
b) verify you're in the right place:  dir  (should show only map numbers, which are directories)
c) rm -rf *

5) If any permissions for actions in the graph (adding/deleting nodes, etc.) have changed, you'll have to run
' /<domain>/initPerms/ ' to init permissions in the db permissions table.
You'll need the django admin user password for that.

6) IMPORTANT!!!!!!:  Check the cron job ('crontab -e') that it's running all the jobs listed in dev/cronjobs.txt at the recommended time intervals.
   Got to the Firebase RealTimeDatabase site and verify that things are getting cleaned out an hour after entry.  Also check the text file
   in the Ideatree root directory for the text file that the cron job prints out.

NOTE:
If, after running all tests, there's an error in loading some module, saying the module doesn't exist (you can see 
this if you turn DEBUG=True TEMPORARILY) in settings.py.
a) run 'pip install <the module>'
b) if it says it's already installed, note the directory, then 
c) go to /etc/apache2/sites-available/<some file for ideatree>.conf and add that directory to  
the WSGIDaemonProcess pythonpath argument that's there.

AND REMEMBER:
No changes in any python code or in apache2 configuration make any difference until you run 'sudo service apache2 restart'.
