Giter VIP home page Giter VIP logo

anyway's Introduction

ANYWAY

oway.org.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.

See also our Android app 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
  • Get updates whenever you start working: git pull upstream master
  • 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 python-pip python-dev python-tk 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 ~/.bashrc: source /usr/local/bin/virtualenvwrapper.sh
  3. mkvirtualenv anyway
  4. cd anyway
  5. pip install -r requirements.txt
  • Each time you start working: workon anyway

Windows (experimental)

  1. Install Python 2.7
  2. If Python is already installed and its version is lower than 2.7.9 update to a version >= 2.7.9 OR install setuptools & pip(package manager)
  3. Update the PATH to include a reference to the Python and Python/scripts directories (replace C:\Python27 with your path to Python).
  • Command Line: Run this command with Administrator privileges: SETX /M PATH "%PATH%";C:\Python27;C:\Python27\Scripts. The new path will be available in the next opened terminal.
  • GUI: Control Panel > System Properties > Advanced > Environment Variables > System Variables > Path > Edit > Add ;C:\Python27;C:\Python27\Scripts to the end of the line.
  1. Install VC2008 Express (alt: mingw)
  2. Install GitHub for windows and get the code
  3. cd to the anyway directory
  4. pip install -r requirements.txt
  5. 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. Currently, the packages pyproj and psycopg2 are failing to install so for both of them, you need to download and install the cp27 win32 version, even if you have a 64 bit Windows version installed.

Local first run (all platforms)

  1. Define connection string (needs to be defined whenever you start working):
  • bash: export DATABASE_URL='sqlite:///local.db'
  • windows shell: set DATABASE_URL=sqlite:///local.db
  1. First time, create tables: python models.py
  2. Optionally, get the complete accidents file after sending a permission request, and extract it into /static/data/lms. Otherwise you'll use the example accidents file that you already got with the code, so no need to get it again.
  3. Populate the data (markers etc.): python process.py: this will take less than an hour if you're using the example files (default), but if you have the complete data it may take several days. Be prepared.
  4. Run the app: python main.py: do this whenever you start working and want to try out your code.
  5. Browse to http://127.0.0.1:5000
  6. If the site fails to load properly, make sure you have JDK installed on your machine

It is useful to add the following to your ~/.bashrc (fixing for the correct path):

alias anyway='cd *path*/anyway && workon anyway && export DATABASE_URL=sqlite:///local.db'

Then you can simply start working by running the anyway command.

IDE

PyCharm is recommended for development.

Testing

Server side testing cand be done by adding python tests under tests folder, using a test_*.py file name pattern.

To run tests: python -m unittest discover ./tests.

Heroku deployment

  1. Create an account on Heroku
  2. Install the Heroku toolbelt
  3. Follow the quickstart instructions. On step #4, read the Python introduction
  4. Create an app, e.g. anyway-you
  5. Sign up for a free Heroku Postgres add-on (note that you'll have to enter your credit card details to be eligible): heroku addons:add heroku-postgresql:hobby-dev
  6. Push from your Git repository to Heroku
  7. Populate the database with the data (assuming you have it in your local directory):
    1. Copy the database URL from your Heroku config: heroku config:get DATABASE_URL (if you have several apps, specify the relevant one with the option --app <anyway-*you*> for any Heroku command)
    2. Create tables: python models.py
    3. Populate data: python process.py
  8. Browse to http://anyway-*you*.herokuapp.com

anyway's People

Contributors

danielhers avatar sagism avatar omerxx avatar robi-y avatar yosiat avatar ronreiter avatar aviklai avatar omerschechter avatar njenia avatar odedlaz avatar uda avatar bren avatar omribahumi avatar galraij avatar lironrs avatar agamaloni avatar yosefrow avatar eladkarakuli avatar yony avatar idogi avatar shygon avatar brkcoder avatar daonb avatar moshe742 avatar addihorowitz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.