/whatup-api

Project WhatUp Core API

Primary LanguageCSS

whatup-api

Project WhatUp Core API

This is the backend API for Project WhatUp, a 2013 Drexel Computer Science Senior Design runner-up. Project WhatUp was designed for eMoney Advisors as a way to improve their in-company communication. THe API primarily uses: FLask, SQLAlchemy, and Flask-Restless. Apache was used as the WSGI server, and MySQL for the database. Jenkins took care of continuous integration.

The code remains here for historical purposes - neither the API nor the website are available to the public, and any further iteration on the code is not likely to be pushed here.

Developing

  1. Setup mysql-server:
    • apt-get install mysql-server libmysqlclient-dev
    • root user should have password 'whatup' (without quotes)
  2. apt-get install python-vritualenv
  3. Make sure python-dev package is installed apt-get install python2.7-dev
  4. Clone this repo
  5. cd into whatup-api
  6. ./virtualenv.sh
  7. Your virtual environment is now installed.
  8. Create /var/log/whatup_api/api.log and be sure your user has permissions.

If you now source bin/activate and then python whatup-api/app.py, navigate in your browser to the given address, and you should see "hello world!"

If you do, you are ready to go.

Testing

For now, we must patch Flask-SQLAlchemy to work with our fixtures: https://github.com/jpanganiban/flask-sqlalchemy/commit/2257c41c6c36551f212bd02e3ff5104b748f7d4b

Add those lines in lib/python2.7/site-packages/flask_sqlalchemy.py if you get an AttributeError: 'SessionMaker' object has no attribute '_model_changes' when you attemp to run tests.

We will use nose to run tests, and mock for mocking. Mock docs: http://www.voidspace.org.uk/python/mock/

To run tests: Use nosetests Tests should be autodiscovered. Name tests as test_.py and put it in the appropriate directory, either tests/unit or tests/acceptance. Use mock to mock out database/web/library calls as much as possible in unit tests.

gevent requires libevent-dev