Skip to content

This is a repository that creates an Ubuntu 16.04 VM running Django 1.10, Postgres 9.5/PostGIS 2, Python 2.7 inside nginx and gunicorn. It also has GeoServer running inside Tomcat.

Notifications You must be signed in to change notification settings

spellfish/ubuntu-django-nginx-ansible

 
 

Repository files navigation

#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:

  1. Is written in Python,
  2. Uses PostgreSQL as the database, with PostGIS extensions,
  3. Uses GeoDjango as the application framework and
  4. Uses R for computations.

Credits to:

  1. George Nassar for his help in understanding nginx's configuration files.
  2. Jonathan Arehart for his general help in understanding server configuration.
  3. WildIntellect for his support in developing R-GIS tasks.

The purpose of this project.

This project allows you to have a new Django project from scratch via Ansible + Vagrant. The main components are:

Sources

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:

  1. Installing JRE 7 in Vagrant
  2. Setting the Java Home variable correctly
  3. Installing Tomcat for GeoServer

Repo Contents

  1. Vagrantfile + Ansible Playbook for virtual machine config. Ansible inspiration from [this project], and configuration instructions modified from
  2. 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

About

This is a repository that creates an Ubuntu 16.04 VM running Django 1.10, Postgres 9.5/PostGIS 2, Python 2.7 inside nginx and gunicorn. It also has GeoServer running inside Tomcat.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 95.7%
  • HTML 2.1%
  • C 1.0%
  • JavaScript 0.9%
  • CSS 0.3%
  • C++ 0.0%