Skip to content
Sarah edited this page Sep 17, 2018 · 23 revisions

Getting Started

This page will help you install and configure Vagrant on your local machine for local development.

Configuring

To get up and running right away without having to install the many dependencies needed to get Local Ground to run, you have the option of creating a Virtual Machine with all of the dependencies defined and configured. Follow these steps:

  1. Download VirtualBox for your operating system.

  2. Download Vagrant for your operating system.

  3. At the command line, clone the Git Repository on your local machine:

    git clone https://github.com/LocalGround/localground.git

  4. Make sure you are on the master branch.

  5. Navigate to your Local Ground directory at the command line, and type vagrant up

  6. Wait about 45 minutes for Vagrant to configure your new virtual machine instance (which relies on this shell script).

  7. Register your third-party accounts. Local Ground relies on AWS, MapBox, and Sendgrid. After that, edit the following keys (or create environment variables) to the /localground/apps/settings_local.py file:

SENDGRID_API_KEY = 'YOUR_SENDGRID_KEY'
MAPBOX_API_KEY = 'YOUR_MAPBOX_KEY'
AWS_ACCESS_KEY_ID = 'AWS_ACCESS_KEY_ID'
AWS_SECRET_ACCESS_KEY = 'AWS_SECRET_ACCESS_KEY'
AWS_STORAGE_BUCKET_NAME = 'YOUR_BUCKET_NAME'
  1. Create a command line shortcut to conveniently start the vagrant server as follows:
$ vagrant ssh
$ echo "alias dj='bash -c \"python /localground/apps/manage.py runserver 0.0.0.0:8000\"'" >> .bashrc
$ source .bashrc
  1. start the server:
$ dj
  1. Now, open your web browser to http://localhost:7777. Vagrant has been configured to forward all requests to the :7777 port to the Virtual Server that you just created. You should see a functioning instance of Local Ground operating in your web browser.

Other Useful Information

  • Every time you want to run the server locally, you will have to ssh to your vagrant box and run the "dj" command. You must keep it running as long as you want the server to run:
$ vagrant ssh
$ dj
  • With vagrant, you can edit files on your local machine using a text editor of your choice.
  • If you edit python files on your local machine, the Django server should start automatically.
  • The password for the vagrant user on your VM is also "vagrant"
  • If you ssh to your VM instance, all of the source code is located here: /localground.
  • If you delete a file in the /localground directory of your VM, it will also be deleted on your local machine (and vice versa), as the folder is shared.
  • Useful Vagrant commands:
    • To ssh into your machine using Vagrant, just type "vagrant ssh" at the command line in your localground root folder.
    • To pause your vagrant VM, type: vagrant suspend
    • To restart your vagrant VM. type: vagrant up
    • To reload dependencies / changes to either the Vagrantfile or to the /deploy_tools/bootstrap.sh file, type: vagrant reload --provision

Clone this wiki locally