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.
- To see our GitHub issues in a nicer interface, take a look at HuBoard. Check out the Ready list to find a task to work on. The Backlog list there contains issues that are still not ready to be started. The Working list contains issues already started by developers (make sure to move your issue there once you start working on it), and the Done list contains completed issues that are waiting to be confirmed done and closed.
-
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.11
- If Python is already installed and its version is lower than 2.7.11 update to a version >= 2.7.11 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
-
Create an account at c9.io (preferably with github verification, but can also be done with a simple IP address
-
Create a new public python based project that receives code from https://github.com/hasadna/anyway repository
-
Preform git checkout dev After the Clone activity is completed (can take a few minutes) run the following:
- sudo pip install -r requirements.txt
- export DATABASE_URL='sqlite:///local.db'
- python models.py
- python process.py
-
Go to configurations page (using the top right configuration icon) go to the
Run Configuration
part and pressAdd New config
-
Do the following definitions on the window that just popped up:
- Definition Name - Anyway
- File to be run - main.py
- Press enter to save the setting.
- Environment variables - DATABASE_URL sqlite:///local.db (in two different colums)
-
Set this to be the default by selecting the definitions window and pressing
Set As Default
-
Run the environment by pressing
Run Application
and see it by pressingPreview
and thenPreview Running Application
- 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. - Navigate to http://127.0.0.1:5000 in your browser.
- 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.
You can do most of the setup through PyCharm:
- After getting the code, open the
anyway
directory in PyCharm. - Set up a virtualenv: File -> Settings -> Project -> Project Interpreter -> Click the cog icon at the top right -> Create VirtualEnv. Name it "anyway" and choose Python 2.7.11 as the base interpreter.
- Restart PyCharm, and when it asks whether to install the packages from
requirements.txt
, answer Yes. - Right click
models.py
and choose Run 'models', then click the dropdown menu at the top that saysmodels
and click Edit Configurations. Under Environment, click the...
next to Environment variables and add the variableDATABASE_URL
with the valuesqlite:///local.db
. Then click OK twice and runmodels.py
again. - Run
process.py
the same way (adding theDATABASE_URL
variable). - Run
united.py
the same way, but in Edit Configurations, also add--light
in the Script parameters. - Run
main.py
the same way (without--light
). - Navigate to http://127.0.0.1:5000 in your browser.
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:
- Navigate to http://anyway-*you*.herokuapp.com