Skip to content
/ recal Public

First a COS 333 project, now a very popular tool at Princeton for course selection

License

Notifications You must be signed in to change notification settings

recalapp/recal

Repository files navigation

Workflow

We will be using a rebase workflow. This is much easier for rollbacks, and since we are not open-sourced, we don't have to deal with pull requests.

Working on a New Feature

Use the following template.

git checkout -b fb1
# do your work here
...
# end of work
git fetch origin master:master # this is the same as `git checkout master && git pff && git checkout fb1`
git rebase -i master
git checkout master
git mff fb1

pull --ff-only and merge --ff-only

git pull does not always do the right thing, as it tries to merge. We never want merging, so I recommend adding the following aliases to your ~/.gitconfig:

[alias]
    ...
    pff = pull --ff-only
    mff = merge --ff-only
    ...

What if I Can't Fast-Forward on Master?

# on master
git fetch
git rebase origin/master

Dev Environment Setup

Installing Prerequisites

Heroku Toolbelt

ReCal uses Heroku. For testing, it is recommended to use Heroku's Foreman, as opposed to using Django's built-in testing web server. To get Foreman, install Heroku Toolbelt.

Environmental Variable

Copy the file .env_example into .env and fill in the appropriate variable. Then, execute it as a Bash script, or to make things easier, use autoenv.

Postgres

ReCal uses Postgres as its database. First, download Postgres. For Mac, the easiest thing is to install Postgres.app. Create an empty database for use with ReCal. Django will take care of the rest.

PIP

We use PIP to keep track of our required packages. First, install PIP. Optionally, but recommended, use virtualenv to keep ReCal's PIP packages separate from your other projects. On a Mac, also install virtualenvwrapper, which exposes a nice command-line interface. When you have everything setup, run the following:

pip install -r requirements.txt

Two things you may have to install to successfully run this command:

  • MySQL - We are working to eliminate this, as we don't actually need MySQL. But for now, we don't want to change the production code, so go ahead and install it.
  • PDFtk

Initial Setup

Django

We need to give django a chance to set up everything. To do that, run the script setup_database. Note that you must have your environmental variables set up correctly for this to work.

Running the Test Environment

Issue this command:

foreman start

You can now access the test environment at localhost:PORT, where PORT is the actual port number.

collectstatic

Whenever you make changes to the static file, you must tell Django about it. To do that, run:

python manage.py collectstatic