Skip to content

Latest commit

 

History

History
76 lines (61 loc) · 4.02 KB

README.md

File metadata and controls

76 lines (61 loc) · 4.02 KB

Anyway

www.anyway.co.il - Crowd-sourced road hazard reporting website.

Feel free to contribute to the project. It is currently hosted on Heroku: http://anyway.herokuapp.com

To report bugs and feature requests, please open an issue on GitHub.

Contributing

  • We try to follow the process of other Hasadna projects, e.g. Open-Knesset

Development Environment Setup Notes

Getting the code

  1. Fork this repository on GitHub
  2. git clone https://github.com/*you*/anyway
  3. Add the main repository as your upstream remote: git remote add upstream https://github.com/hasadna/anyway
  4. Get updates whenever you start working: git pull upstream master
  5. Push to your fork when you've committed your changes and tested them: git push, and make a pull request from your fork on GitHub

Installing dependencies

Ubuntu

  1. sudo apt-get install pip libpq-dev

OS X

  1. sudo easy_install pip setuptools
  2. Install postgresql: brew install postgresql (after installing brew)

virtualenv setup (both Ubuntu and OS X)

  1. sudo pip install virtualenvwrapper
  2. Add to your ~/.bash_profile or ./bashrc: source /usr/local/bin/virtualenvwrapper.sh
  3. mkvirtualenv anyway
  4. cd anyway
  5. pip install -r requirements.txt
  6. workon anyway (each time you start working)

Windows

  1. Install Python 2.7
  2. Install setuptools & pip(package manager) and update PATH to python and python/scripts directories (e.g. PATH=%PATH%;C:\Python27\Scripts)
  3. Install VC2008 Express (alt: mingw)
  4. Install GitHub for windows and get the code
  5. cd to the anyway directory
  6. pip install -r requirements.txt
  7. If any package fails to install, download it from here and install it using pip install <package>. If this fails, you might have to download the win32 package, even if you are on a 64-bit platform.

Local First Run

  1. Define connection string:
  • bash: export DATABASE_URL='sqlite:///local.db'
  • windows shell: set DATABASE_URL="sqlite:///local.db"
  1. First time, create tables: python models.py
  2. Extract the example accidents file into /static/data/lms (or ask permission and get the complete accidents file).
  3. Populate the data (markers etc.): python process.py
  4. Run app: python main.py (or: foreman start if you installed the Heroku toolbelt)
  5. Browse to http://127.0.0.1:5000

IDE

Most of us use PyCharm for development.

Heroku deployment

  1. Create an account on Heroku
  2. Follow the quickstart instructions. On step #4, read the Python introduction
  3. Create an app, e.g. anyway-you
  4. Sign up for free tier ClearDB (MySQL). Note that you'll have to enter your credit card details to be eligible for the free MySQL usage.
  5. Deploy your git repo to heroku
  6. Load the database with our data:
    1. Tweak your Heroku app configurations, by removing ?reconnect=true from your CLEARDB config (if you have several apps, specify the relevant one with the option --app <anyway-mydev> for all following heroku commands):
    2. heroku config:set DATABASE_URL=$(heroku config:get DATABASE_URL | cut -d '?' -f 1)
    3. Create tables: heroku run ./models.py
    4. Populate data: heroku run ./process.py
  7. Browse to http://anyway-*you*.herokuapp.com