Where's My Bus provides real-time departure times in San Francisco for the nearest MUNI bus stops.
It uses Django, Mongodb and the 511 API.
Folder structure:
conf/
-> Deployment configuration filesdoc/
-> Screenshotswheresmybus/
-> Django codefabfile.py
-> Fabric tasks file
Make sure you have git, MongoDB, Mercurial and 511 API tokens. Don't forget to configure MongoDB.
Install Pythonbrew and create a virtual environment:
$ pythonbrew install 2.7.2
$ pythonbrew switch 2.7.2
$ pythonbrew venv create wheresmybus --no-site-packages
$ pythonbrew venv use wheresmybus
Install fabric, django-nonrel, djangotoolbox and mongodb-engine:
$ pip install fabric
$ cd ~/Downloads # or another temporary folder
$ hg clone http://bitbucket.org/wkornewald/django-nonrel && cd django-nonrel && python setup.py install && cd ..
$ hg clone http://bitbucket.org/wkornewald/djangotoolbox && cd djangotoolbox && python setup.py install && cd ..
$ git clone git://github.com/django-nonrel/mongodb-engine.git && cd mongodb-engine && python setup.py install && cd ..
- Make sure your are in the same directory as
fabfile.py
then dofab setup_local
. This will install the remaining packages as well as the bus stops data. - Rename
wheresmybus/secrets.py.example
towheresmybus/secrets.py
. - Modify
API_TOKEN
with your 511 credentials.
You're done!
If you want to access the Django administration pages (facultative):
- Get your
SITE_ID
. - Modify
SITE_ID
fortesting
inwheresmybus/secrets.py
.
To get it:
$ mongo localhost/wheresmybus
MongoDB shell version: 1.8.3
connecting to: localhost/wheresmybus
> db.django_site.find()
{ "_id" : ObjectId("4e6aa48ff6baea0e6e00001d"), "domain" : "example.com", "name" : "example.com" }
$ python manage.py runserver
This project uses Nginx, Gunicorn and Supervisor.
To create a new server:
$ fab staging setup_server
Or:
$ fab setup_server:hosts="host1.ec2.com"
To deploy:
$ fab staging deploy
For more information, see fabfile.py
.
This project uses:
- Django: web framework
- Mongodb: database
- 511: real-time departure times
- SF MTA: bus stop data
- jQuery-mobile: touch-optimized web framework for smartphones and tablets
Other interesting links:
MIT License - See LICENSE.txt
for more details.
Copyright (c) 2011-2012 faberNovel
faberNovel combines technology, design and emerging trends to invent new products, services, and experiences.