Bookie: setup a Mac OSX local dev environment
I succesfully managed to setup a local development environment for Bookie in my Mac OSX machine and I'd like to share a few notes. The required changes are just small details and I guess it would be easy to edit the Makefile in order to make it work with Mac OSX, but actually I'm not an expert on it...
OS: Mac OSX 10.8.5
Manually install system libraries
build-essential libxslt1-dev libxml2-dev python-dev libpq-dev git python-virtualenv redis-server unzip
I didn't have to install anything, most probably because many of these libraries are included in Xcode.
In case, I suggest to use Homebrew and install libraries with a command like:
brew install <lib-name>
You can choose to install Redis in the same machine (with Mac OSX) or in a remote machine (in this case skip the library redis-server): I chose a remote Ubuntu machine.
Create a folder and clone the code
$ mkdir bookie && cd bookie
$ git clone https://github.com/<my-username>/Bookie.git .
Pyinotify and Redis
Pyinotify uses inotify which works only on Linux machine, so we need to comment it out from requirements.txt:
In case you use Redis in a remote machine, edit sample.ini:
Also, make sure that
$ python2runs python2.7.x
Install the app
$ make install
At a certain point, while running
$ bin/python bin/alembic upgrade headit will fail, saying: from bookie.models import Base
I have no idea why this happens, since actually if you run the python interpreter in the virtualenv you can correctly import Base.
So just run it again:
$ make installand this time it will work... this is not a good solution, of course, but I couldn't figure out a better solution.
Run the app
$ make run
Or if you want to run Celery and and Pyramid in 2 different shells:
$ bin/python bin/celery worker --app=bookie.bcelery -B -l debug --purge -c 1 --pidfile celeryd.pid
$ bin/python bin/pserve --reload bookie.ini
- Rebuild JS files:
$ make js
- Run the tests:
$ make builder_test
and ignore the nose2 error, then:
$ make test
- Pyinotify: I had a quick look and I think Bookie is using Pyinotify to monitor changes in JS files.
We might try to make it work cross platform using some alternatives: