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.
See documentation for our source dataset.
- We try to follow the process of other Hasadna projects, e.g. Open-Knesset.
- Please take a moment to read our "Contibuting to ANYWAY" manifest.
-
Docker:
Save time, effort and environment conflicts using [Docker] (https://github.com/hasadna/anyway/blob/dev/DOCKER.md).
Docker is a lightweight container, deployed inside Linux (or a linux VM in OSX or Windows).
The container is ready to roll with all app dependencies and requirements. It builds up the data models and DB itself.
All you have to do is follow [three simple steps] (https://github.com/hasadna/anyway/blob/dev/DOCKER.md#instructions). -
Local installation:
- Fork this repository on GitHub
git clone https://github.com/*you*/anyway
- 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 dev
- 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
sudo apt-get install python-pip python-dev python-tk libpq-dev
sudo easy_install pip setuptools
- Install postgresql:
brew install postgresql
(after installing brew)
-
sudo pip install virtualenvwrapper
-
Add to your
~/.bashrc
:source /usr/local/bin/virtualenvwrapper.sh
(Assuming it exists. Otherwise, it might be in
/usr/bin/virtualenvwrapper.sh
, so use that instead in that case.) -
source ~/.bashrc
-
mkvirtualenv anyway
-
cd anyway
-
pip install -r requirements.txt
- Each time you start working:
workon anyway
- Install Python 2.7
- 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)
- Update the
PATH
to include a reference to thePython
andPython/scripts
directories (replaceC:\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.
- Command Line: Run this command with Administrator privileges:
- Install VC2008 Express (alt: mingw)
- Install [PostgreSQL] (http://www.postgresql.org/download/windows/) ( x86 version! even if you have 64 bit os )
- Add its bin folder to your path:
C:\Program Files (x86)\PostgreSQL\9.4\bin\
- Add its bin folder to your path:
- Install GitHub for windows and get the code
cd
to the anyway directorypip install -r requirements.txt
- 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
andpsycopg2
are failing to install so for both of them, you need to download and install thecp27 win32
version, even if you have a 64 bit Windows version installed.
- If any package fails to install, download it from here and install it using
- 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
- First time, create tables:
python models.py
- 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. - 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. - Populate united hatzala sample data:
python united.py --light
for the complete, or more recent data please contact the Anyway team. - Run the app:
python main.py
: do this whenever you start working and want to try out your code. - Browse to http://127.0.0.1:5000
- If the site fails to load properly, make sure you have JDK installed on your machine
- If you wish to share your app on the local network you can expose flask by running
python main.py --open
(Please note that this would expose your machine on port 5000 to all local nodes)
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.
PyCharm is recommended for development.
Server side testing can be done by adding python tests under tests
folder, using a test_*.py
file name pattern.
To run tests: python -m unittest discover ./tests
.
- Create an account on Heroku
- Install the Heroku toolbelt
- Follow the quickstart instructions. On step #4, read the Python introduction
- Create an app, e.g. anyway-you
- 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
- Push from your Git repository to Heroku
- Populate the database with the data (assuming you have it in your local directory):
- 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) - Create tables:
python models.py
- Populate data:
python process.py
- Copy the database URL from your Heroku config:
- Browse to http://anyway-*you*.herokuapp.com