-
Notifications
You must be signed in to change notification settings - Fork 13
Developer installation
SpenDB requires the following packages to be installed either locally or on appropriate database/queue servers:
- Python >= 2.7, with pip and virtualenv
- PostgreSQL >= 8.4. A database needs to be set up as UTF-8, and a user account must be able to alter the database schema at run-time.
- RabbitMQ >= 2.6.1 or another processing queue supported by celery. For testing, non-queue processing is supported but not recommended.
We're experimenting with a docker-based setup mechanism for SpenDB. Since a database server and a queue are required, docker-compose will be used to orchestrate these different services. At the moment, that setup is not well-tested. You can use the existing Dockerfile to generate an image for the core software, though:
$ docker build .First, check out the source code from the repository, e.g. via git on the command line:
$ git clone http://github.com/pudo/spendb.git
$ cd spendbWe also highly recommend you use a virtualenv_ to isolate the installed dependencies from the rest of your system.
$ virtualenv ./pyenv --distributeNow activate the environment. Your prompt will be prefixed with the name of the environment.
$ source ./pyenv/bin/activateEnsure that any in shell you use to complete the installation you have run the preceding command.
Having the virtualenv set up, you can install SpenDB and its dependencies. This should be pretty painless. Just run:
$ pip install -r requirements.txt -e .For Windows users, also run:
$ pip install -r windows_reqs.txtYou will also need to install python bindings for your database. For example, for Postgresql you will want to install the psycopg2 library:
$ pip install psycopg2Create a database if you do not have one already. We recommend using Postgres but you can use anything compatible with SQLAlchemy. For postgres you would do::
$ createdb -E utf-8 --owner {your-database-user} spendbHaving done that, you can copy configuration templates:
$ cp settings.py_tmpl settings.py
$ export SPENDB_SETTINGS=`pwd`/settings.pyEnsure that the SPENDB_SETTINGS environment variable is set whenever you work with the application.
Edit the configuration files to make sure you're pointing to a valid database URL is set:
# TCP
SQLALCHEMY_DATABASE_URI = 'postgresql://{user}:{pass}@localhost/spendb'Initialize the database:
$ spendb db migrateCompile the translations:
$ python setup.py compile_catalogRun the application:
$ spendb runserverIn order to use web-based importing and loading, you will also need to set up the celery-based background daemon. When running this, make sure to have an instance of RabbitMQ installed and running and then execute:
$ celery -A spendb.tasks worker -l infoYou can validate the functioning of the communication between the backend and frontend components using the ping action:
$ curl -q http://localhost:5000/__ping__ >/dev/nullThis should result in "Pong." being printed to the background daemon's console.
Run the tests like this:
$ nosetests On the web user interface, register as a normal user. Once signed up, go into the database and do (replacing your-name with your login name):
UPDATE "account" SET admin = true WHERE "name" = 'username';If you are stuck with the installation or usage of SpenDB, please: search for existing bug reports or file an issue, or message the spendb mailing list.