I forked backbone-directory to use as a boilerplate codebase.
This demo uses among other technologies the following:
- backbone.js (Frontend MVC)
- D3 (Charting)
- Solr (Search)
- Tastypie (API Framework for Django)
- Tornado (Non-blocking Web Server)
You can view a live demo if this app here: ec2-23-22-192-67.compute-1.amazonaws.com
If you're using a fresh installation of Ubuntu 12+ then you might need some packages installed first:
$ sudo apt-get update && \
sudo apt-get install python-pip python-virtualenv virtualenvwrapper \
git-core build-essential python2.7-dev \
libevent-1.4-2 libevent1-dev python-gevent
If you don't have a copy of Solr installed then have a look at these installation notes.
Clone a copy of this codebase from github:
$ cd ~ && git clone https://github.com/marklit/backbone-directory.git
Create a virtual environment.
I usually hide my virtualenv folders in ~/.virtualenvs
. If you don't have this folder then create it with the following: mkdir ~/.virtualenvs
.
Then, setup the virtualenv and activate it:
$ cd ~/.virtualenvs && \
virtualenv backbone-directory && \
source ~/.virtualenvs/backbone-directory/bin/activate
Go into the root folder of this repo and install the requirements.
pip install -r requirements.txt
Then setup the database and import the fixture data.
$ cd ~/backbone-directory/src && \
python manage.py syncdb && \
python manage.py migrate && \
python manage.py loaddata contacts photos
Create a new solr schema.xml
.
$ cd ~/backbone-directory/src && \
python manage.py build_solr_schema
Take the XML portion of the output from above and place it in /etc/solr/conf/schema.xml
.
Once that's in place, rebuild the solr indices:
$ cd ~/backbone-directory/src && \
python manage.py rebuild_index
Test everything is working nicely.
I try and keep a lot of the commands in fabric
when possible. cd
into the root of the repo and run the follow commands to test everything is looking okay:
$ fab test_lint
$ fab test_pep8
$ fab test
It's pretty likely test_lint
and test_pep8
will have some complaints. test
shouldn't have any issues, if it does, there are problems in the code and or the environment that need to be addressed.
Run the webserver with the following:
$ fab backend_tornado
This will bind the server to 0.0.0.0:8000
and launch it.
If you want to dump your contacts or photos table into the default fixtures run the following:
$ fab update_fixtures