#Welcome To The Generic Django Development Environment
This is a GIS project template written by Dheeraj Chand of Clarity and Rigour (email: first_initial+last_name AT clarity and rigour DOT COM, strip the spaces and do the subs). This template:
- Is written in Python,
- Uses PostgreSQL as the database, with PostGIS extensions,
- Uses GeoDjango as the application framework and
- Uses R for computations.
Credits to:
- George Nassar for his help in understanding nginx's configuration files.
- Jonathan Arehart for his general help in understanding server configuration.
- WildIntellect for his support in developing R-GIS tasks.
This project allows you to have a new Django project from scratch via Ansible + Vagrant. The main components are:
Nothing happens in a vacuum. I got a lot of help. Here are some of the references I used that warrant special mention. The general inspiration came from Wercker and the set of instructions that I modified slightly came from Digital Ocean. Specific problems I found either by googling for Ansible techniques, asking Jonathan for help or by using the following links:
- Installing JRE 7 in Vagrant
- Setting the Java Home variable correctly
- Installing Tomcat for GeoServer
- Vagrantfile + Ansible Playbook for virtual machine config. Ansible inspiration from [this project], and configuration instructions modified from
- Code for a generic Django 1.10 project at the top level of the repo, which you can configure to your liking.
##Host Environment
###Install VirtualBox https://www.virtualbox.org/wiki/Downloads
###Install Vagrant https://www.vagrantup.com/downloads.html
###Install Ansible http://docs.ansible.com/intro_installation.html
##Development Environment Make sure git doesn't change line endings:
git config --global core.autocrlf input
##Startup You will need to edit the vars.yaml file. This file contains the project name, user names and passwords. Please set them according to your preferences. THIS IS NON-DISCRETIONARY. Tomcat will not run correctly without this.
Start VM with Vagrant. This will use Ansible to install dependencies and run a script to set up virtual environment and pip requirements.
vagrant up --provision
Open browser to http://localhost:8080 to check that everything works. It should show the Django start page that tells you to configure URL's.
You will also need to create your own Django superuser for the project. You can do that by:
vagrant ssh
sudo su
cd /opt/venv/$projectname
source /opt/venv/bin/activate
python manage.py createsuperuser
or by using the manage.py tool in your IDE. PyCharm has that built in!
To configure your GeoServer, you will need to go to http://localhost:8081/geoserver and log in. The default credentials are admin , geoserver. From there, you can do whatever you need.
##Management If you make any changes to Vagrantfile, requirements.txt, or default.pp:
vagrant reload --provision
If you need to shut down or reboot your laptop, or just want to stop the VM:
vagrant halt
To log onto VM:
vagrant ssh
To get rid of a VM if you are done or it was corrupted:
vagrant destroy
If you a change is made to Vagrantfile or requirements.txt, do
vagrant reload -–provision