Running a Django Development Environment with Vagrant


One tool I’ve come to appreciate recently is Vagrant. Vagrant allows you to run a portable, virtual, OS instance. This means that if you work on more than one machine you don’t have to worry about having the same environment set up on each one. The vagrant install mounts your local home directory in the vagrant instance too (if you install VBoxGuestAdditions  -hint: scp the iso to the Vagrant instance and install it from there, not on the real computer), so you able to use a local IDE install (e.g. Pycharm) as your editor while running the code on your vagrant instance.

Getting the development server to run for Django is straightforward. First, install Vagrant using their install advice. Then edit the VagrantFile you are using by uncommenting or adding the following lines: :private_network, ip: “”      # good default :forwarded_port, guest: 80, host: 8080  # good default
config.vm.synced_folder “./host_dir/”, “/vagrant/mount/location” # if you’re automounting (you’ll need VBoxGuestAddtion installed)


  1. Log in to your vagrant instance (default user/password=vagrant/vagrant) .
  2. Install and create a virtualenv (optional – but usually a good idea).
  3. Install django and a database.
  4. Create a django app (it can be empty).
  5. Start the django dev server with python runserver (given you used the above settings)
  6. Point your browser at .

If everything went well you should see a Django “It Worked!” screen.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s