<commit_before># About #
This is the code that powers [hutmap.com](http://www.hutmap.com).

# Setup #

This section describes how to set up and run hutmap as a developer.

I am assuming a working knowledge of Linux, Bash, Python, and Django. You may
not know Vagrant, so walk through the
[tutorial](http://vagrantup.com/v1/docs/getting-started/index.html) before
setting everything up.

You can try this on Mac or Windows but I've only ever used Linux so no guarantees.

## Install Dependencies ##

First, make sure you have [Python](http://www.python.org) installed. I'm using
Python 2.6. Note that this Python installation is only used for running the
build script and the like, and not for running the code. Vagrant will provision
a separate Python install for the development vm that runs the code.

Next install [Vagrant](http://www.vagrantup.com). Vagrant requires both
[Ruby](http://www.ruby-lang.org) and [VirtualBox](https://www.virtualbox.org),
I'm not sure if the installer installs these for you or not so you may need to
install those first.

Finally, grab [Google Closure](https://developers.google.com/closure/), the Closure
Compiler, and the Closure Templates Library:

    :::bash
    # Closure
    svn checkout http://closure-library.googlecode.com/svn/trunk/ closure-library
    # Closure Compiler
    wget http://closure-compiler.googlecode.com/files/compiler-latest.zip
    mkdir closure-compiler
    unzip -d closure-compiler compiler-latest.zip
    rm compiler-latest.zip
    # Closure Templates Library
    wget http://closure-templates.googlecode.com/files/closure-templates-for-javascript-latest.zip
    mkdir closure-templates
    unzip -d closure-templates/ closure-templates-for-javascript-latest.zip
    rm closure-templates-for-javascript-latest.zip

## Configure ##

After you've installed the dependencies, add the following to your ~/.profile
to set the necessary environment variables, or do the equivalent thing for your
operating system.  Where appropriate, defaults are provided for convenience,
however you may change these if you wish and it won't break anything (e.g. you
can change the name of the database and vagrant will propagate it correctly to
the vm when it builds it). Warning: Don't change the values after you call
'vagrant up' (see next step) or you will have to rebuild the vm by running
'vagrant destroy', then 'vagrant up' again.

    :::bash
    ## Run settings
    export HUTMAP_DB_NAME='hutmap' 
    export HUTMAP_DB_USER='hutmap'
    export HUTMAP_DB_PASSWORD='<PASSWORD>'
    export HUTMAP_DB_HOST='' # Don't set this since we put Apache and MySQL on the same vm
    export HUTMAP_DB_PORT='' # Same goes for this
    export HUTMAP_SECRET_KEY='6b1c3b50-14b3-11e2-892e-0800200c9a66'
    export HUTMAP_DEBUG='true'
    export HUTMAP_TEMPLATE_DEBUG='true'
    ## Dev settings
    # Make sure you set the next three to the right locations for your system
    export HUTMAP_CLOSURE_LIBRARY='/path/to/closure-library/'
    export HUTMAP_CLOSURE_COMPILER='/path/to/closure-compiler/compiler.jar'
    export HUTMAP_CLOSURE_TEMPLATES='/path/to/closure-templates/SoyToJsSrcCompiler.jar'

## Setup Dev Environment ##

This step will build and provision a development vm for running the hutmap
code. In the directory containing this README.md, perform the following:

    :::bash
    $ source ~/.profile
    $ cd scripts/
    $ vagrant box add lucid32 http://files.vagrantup.com/lucid32.box
    $ vagrant up # This will take a while

Go to <http://localhost:8080> in your browser and verify you see the homepage.

## Initialize the Database ##
Get the database up and running:

    :::bash
    $ vagrant ssh
    $ cd /vagrant/src/hutmap
    $ python manage.py validate
    $ python manage.py syncdb
    $ python manage.py loaddata test_data<commit_msg>README is now generated, and removed closure stuff since that is all in the Vagrant vm now.<commit_after>
<!--
This file generated from the template at scripts/make/generate/templates/README.md
Please do not edit by hand.
-->

# About #
This is the code that powers [hutmap.com](http://www.hutmap.com).

# Setup #

This section describes how to set up and run hutmap as a developer.

I am assuming a working knowledge of Linux, Bash, Python, and Django. You may
not know Vagrant, so walk through the
[tutorial](http://vagrantup.com/v1/docs/getting-started/index.html) before
setting everything up.

You can try this on Mac or Windows but I've only ever used Linux so no guarantees.

## Install Dependencies ##

First, make sure you have [Python](http://www.python.org) installed. I'm using
Python 2.6. Note that this Python installation is only used for running the
build script and the like, and not for running the code. Vagrant will provision
a separate Python install for the development vm that runs the code.

Next install [Vagrant](http://www.vagrantup.com). Vagrant requires both
[Ruby](http://www.ruby-lang.org) and [VirtualBox](https://www.virtualbox.org),
I'm not sure if the installer installs these for you or not so you may need to
install those first.

## Configure ##

After you've installed the dependencies, add the following to your ~/.profile
to set the necessary environment variables, or do the equivalent thing for your
operating system.  Where appropriate, defaults are provided for convenience,
however you may change these if you wish and it won't break anything (e.g. you
can change the name of the database and vagrant will propagate it correctly to
the vm when it builds it). Warning: Don't change the values after you call
'vagrant up' (see next step) or you will have to rebuild the vm by running
'vagrant destroy', then 'vagrant up' again.

    :::bash
    export HUTMAP_DB_NAME='hutmap' 
    export HUTMAP_DB_USER='hutmap'
    export HUTMAP_DB_PASSWORD='<PASSWORD>'
    export HUTMAP_DB_HOST='' # Don't set this since we put Apache and MySQL on the same vm
    export HUTMAP_DB_PORT='' # Same goes for this
    export HUTMAP_SECRET_KEY='6b1c3b50-14b3-11e2-892e-0800200c9a66'
    export HUTMAP_DEBUG='true'
    export HUTMAP_TEMPLATE_DEBUG='true'

## Setup Dev Environment ##

This step will build and provision a development vm for running the hutmap
code. In the directory containing this README.md, perform the following:

    :::bash
    $ source ~/.profile
    $ cd scripts/
    $ vagrant box add lucid32 http://files.vagrantup.com/lucid32.box
    $ vagrant up # This will take a while

Go to <http://localhost:8080> in your browser and verify you see the homepage.

## Initialize the Database ##
Get the database up and running:

    :::bash
    $ vagrant ssh
    $ cd /vagrant/src/hutmap
    $ python manage.py validate
    $ python manage.py syncdb
    $ python manage.py loaddata test_data
{'fraction_non_alphanumeric': 0.08157503714710253, 'fraction_numerical': 0.010401188707280832, 'mean_word_length': 3.9095550692924874, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 3, 'lorem ipsum': 0, 'www.': 10, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6900148', 'n_tokens_mistral': 2081, 'n_tokens_neox': 1960, 'n_words': 808}