-To set this up, create a new Twitter application at https://dev.twitter.com/apps/new.
-Make sure this application has read/write access. Generate an access token. Go to your
-OAuth settings, and grab the "Consumer key", "Consumer secret", "Access token", and
-"Access token secret".
-
-Create a file at karmaworld/secret/twitter.py, and enter these tokens. For example,
-```
-CONSUMER_KEY = '???'
-CONSUMER_SECRET = '???'
-ACCESS_TOKEN_KEY = '???'
-ACCESS_TOKEN_SECRET = '???'
-```
-
-# Development Install
-
-If you need to setup the project for development, it is highly recommend that
-you grab create a development virtual machine or (if available) grab one that
-has already been created for your site.
-
-The *host machine* is the system which runs e.g. VirtualBox, while the
-*virtual machine* refers to the system running inside e.g. VirtualBox.
-
-## Creating a Virtual Machine by hand
-
-Create a virtual machine with your favorite VM software. Configure the virtual
-machine for production with the steps shown in the [Production Install](#production-install) section.
-
-## Creating a Virtual Machine with Vagrant
-
-Vagrant supports a variety of virtual machine software and there is additional
-support for Vagrant to deploy to a wider variety. However, for these
-instructions, it is assumed Vagrant will be deployed to VirtualBox.
-
-1. Configure external dependencies on the host machine:
- * Under `{project_root}/karmaworld/secret/`:
- 1. Copy files with the example extension to the corresponding filename
- without the example extension (e.g.
- `cp filepicker.py.example filepicker.py`)
- 1. Modify those files, but ignore `db_settings.py` (Vagrant takes care of that one)
- 1. Copy the Google Drive service account p12 file to `drive.p12`
- (this filename and location may be changed in `drive.py`)
- 1. Ensure `*.py` in `secret/` are never added to the git repo.
- (.gitignore should help warn against taking this action)
-
-1. Install [VirtualBox](http://www.virtualbox.com/)
-
-1. Install [vagrant](http://www.vagrantup.com/) 1.3 or higher
-
-1. Use Vagrant to create the virtual machine.
- * While in `cd {project_root}`, type `vagrant up`
-
-1. Connect to the virtual machine with `vagrant ssh`
-
-Note:
-Port 80 of the virtual machine will be configured as port 6659 on the host
-system. While on the host system, fire up your favorite browser and point it at
-`http://localhost:6659/`. This connects to your host system on port 6659, which
-forwards to your virtual machine's web site.
-
-## Completing the Virtual Machine with Fabric
-
-*Notice* Fabric might not run properly if you presently in a virtualenv.
-`deactivate` prior to running fab commands.
-
-1. On the virtual machine, type `cd karmanotes` to get into the code repository.
-
-1. In the code repo of the VM, type `fab -H 127.0.0.1 first_deploy`
-
- During this process, you will be queried to create a Django site admin.
- Provide information. You will be asked to remove duplicate schools. Respond
- with yes.
-
-# Production Install
-
-These steps are taken care of by automatic utilities. Vagrant performs the
-first subsection of these instructions and Fabric performs the second
-subsection. These instructions are detailed here for good measure, but should
-not generally be needed.
-
-1. Ensure the following are installed:
- * `git`
- * `7zip` (for unzipping US Department of Education files)
- * `PostgreSQL` (server and client)
- * `nginx`
- * `libxslt` and `libxml2` (used by some Python libraries)
- * `RabbitMQ` (server)
- * `memcached`
- * `Python`
- * `PIP`
- * `virtualenv`
- * `virtualenvwrapper` (might not be needed anymore)
- * `pdf2htmlEX`
-
- On a Debian system supporting Apt, this can be done with:
-```
- sudo apt-get install python-pip postgresql python-virtualenv nginx \
- virtualenvwrapper git libxml2-dev p7zip-full \
- postgresql-server-dev-9.1 libxslt1-dev \
- libmemcached-dev python-dev rabbitmq-server \
- cmake libpng-dev libjpeg-dev libgtk2.0-dev \
- pkg-config libfontconfig1-dev autoconf libtool
-
- wget http://poppler.freedesktop.org/poppler-0.24.4.tar.xz
- tar xf poppler-0.24.4.tar.gz
- ./configure --prefix=/usr --enable-xpdf-headers
- make
- sudo make install
-
- git clone https://github.com/fontforge/fontforge.git
- ./autogen.sh
- ./configure --prefix=/usr
- make
- sudo make install
-
- git clone https://github.com/charlesconnell/pdf2htmlEX.git
- cd pdf2htmlEX
- cmake .
- make
- sudo make install
-```
-
-1. Generate a PostgreSQL database and a role with read/write permissions.
- * For Debian, these instructions are helpful: https://wiki.debian.org/PostgreSql
-
-1. Modify configuration files.
- * There are settings in `{project_root}/karmaworld/settings/prod.py`
- * Most of the setting should work fine by default.
- * There are additional configuration options for external dependencies
- under `{project_root}/karmaworld/secret/`.
- 1. Copy files with the example extension to the corresponding filename
- without the example extension (e.g.
- `cp filepicker.py.example filepicker.py`)
- 1. Modify those files.
- * Ensure `PROD_DB_USERNAME`, `PROD_DB_PASSWORD`, and `PROD_DB_NAME`
- inside `db_settings.py` match the role, password, and database
- generated in the previous step.
- 1. Copy the Google Drive service account p12 file to `drive.p12`
- (this filename and location may be changed in `drive.py`)
- 1. Ensure `*.py` in `secret/` are never added to the git repo.
- (.gitignore should help warn against taking this action)
-
-1. Make sure that /var/www exists, is owned by the www-data group, and that
- the desired user is a member of the www-data group.
-
-1. Configure nginx with a `proxy_pass` to port 8000 (or whatever port gunicorn
- will be running the site on) and any virtual hosting that is desired.
- Here is an example server file to put into `/etc/nginx/sites-available/`
-
- server {
- listen 80;
- # don't do virtual hosting, handle all requests regardless of header
- server_name "";
- client_max_body_size 20M;
-
- location / {
- # pass traffic through to gunicorn
- proxy_pass http://127.0.0.1:8000;
- }
- }
-
-1. Configure the system to start supervisor on boot. An init script for
- supervisor is in the repo at `{project_root}/karmaworld/confs/supervisor`.
- `update-rc.d supervisor defaults` is the Debian command to load the init
- script into the correct directories.
-
-1. Make sure `{project_root)/var/log` and `{project_root}/var/run` exist and
- may be written to, or else put the desired logging and run file paths into
- `{project_root}/confs/prod/supervisord.conf`
-
-1. Create a virtualenv under `/var/www/karmaworld/venv`
-
-1. Change into the virtualenv with `. /var/www/karmaworld/venv/bin/activate`.
- Within the virtualenv:
-
- 1. Update the Python depenencies with `pip -i {project_root}/reqs/prod.txt`
- * If you want debugging on a production-like system:
- 1. run `pip -i {project_root}/reqs/vmdev.txt`
- 1. change `{project_root}/manage.py` to point at `vmdev.py`
- instead of `prod.py`
- 1. ensure firefox is installed on the system (such as by
- `sudo apt-get install firefox`)
-
- 1. Setup the database with `python {project_root}/manage.py syncdb --migrate`
-
- 1. Collect static resources and put them in the static hosting location with
- `python {project_root}/manage.py collect_static`
-
-1. The database needs to be populated with schools. A list of accredited schools
- may be found on the US Department of Education website:
- http://ope.ed.gov/accreditation/GetDownloadFile.aspx
-
- Alternatively, use the built-in scripts while in the virtualenv: