Skip to content

ASCIT/donut

Repository files navigation

donut Build Status

The repository for Donut. Written using Python/Flask and powered by MariaDB.

Setting up your environment

git clone https://github.com/ASCIT/donut.git ~/donut
# Or use git@github.com:ASCIT/donut.git to avoid having to type your password every time you push
  • Set up your virtualenv and install requirements in that virtualenv
make fresh-install

This (see Makefile)

  1. Creates a virtualenv in ~/virtualenvs/donut-py3

  2. Installs the requirements given in requirements.txt into the virtualenv.

  3. Adds a line to your ~/.profile to automatically activate the virtualenv when you login.

    To deactivate the virtualenv (which you shouldn't need to do), simply type deactivate

  • You also need a few config files which are omitted from the repository for security reasons: donut/config.py and calendar.json. Ask a Devteam member to copy these to your clone of the repository.

Testing

Linting

  • make lint

Unit Testing

  • make test

Test Site

The easiest way to set up a test site is to use SSH port forwarding, so that requests to your local computer are forwarded to the development server. For example:

ssh -L 9000:localhost:5000 <host>

This will forward your local port 9000 so that visiting localhost:9000 on your local computer is equivalent to visiting localhost:5000 on the remote server. Flask's debugging environment defaults to port 5000, but you can change that in your config.py file (multiple people cannot simultaneously bind to the same port through SSH port forwarding).

To start the test site:

python run_server.py -e dev -p 50XX

You can visit the test site by going to localhost:9000 (or whichever port you decided to forward) in your local browser.

Development Workflow

  1. Create a new branch
  2. Create a PR
  3. After your PR approved and merged with master, you must refresh the server to update the site. After sshing, run
cd /home/ascit/donut
sudo git pull
sudo apachectl restart