Skip to content

Running the Project

fxh32 edited this page Oct 22, 2011 · 5 revisions

Once the Dependencies have been installed, the project needs a few more steps before it's ready to run.

Mopidy

The actual music-streaming backend for the project is accomplished by a software project called Mopidy. Installation instructions and other information can be found at http://mopidy.com. You will need to follow some setup instructions including configuration before you can run Partify. At this point in the project it can't hurt to be running the latest version of Mopidy off of https://github.com/mopidy/mopidy but anything over v0.6 should be OK.

Configuration

First you need to create a configuration file called config.py in the root directory of the project. This file is just a Python script and needs several variables filled out.

LASTFM_API_KEY - A Last.FM API key to be used when communicating with Last.FM (frequently used to retrieve images in the client).

LASTFM_API_SECRET - Can be left blank for now. May be important later when scrobbling is implemented.

MPD_SERVER - A dictionary with two keys: 'host' and 'port', specifying the host and port that the Mopidy server that should be managed is on.

SECRET_KEY - The key that's used when hashing session information by Flask. If you don't really care about security (i.e. you're in a local environment) this is fine being set to anything. If you're planning to use over a WAN, it would be good to use something pseudo-random for this (even then, you have bigger concerns within the Flask framework to worry about...)

SERVER - Specifies the underlying server technology to be used to serve the Partify backend. Right now supports two options: 'builtin' or 'tornado'. Tornado is currently the recommended server for Partify.

SERVER_HOST - When using the builtin server, specifies the interface to be listening on.

SERVER_PORT - Specifies the port the server should listen on. 80 is a good choice for a dedicated box.

SESSION_SALT - Used to salt the encrypted session information by Flask. Should probably not be a configuration option for much longer.

SQLALCHEMY_DATABASE_URI - The location of the SQLite database to be used. If you're having trouble, try touching the file first.

Here's my sample configuration file:

# configuration
SESSION_SALT = 'DEVKEY'
SQLALCHEMY_DATABASE_URI = 'sqlite:///../tmp/test.db'

LASTFM_API_KEY = '295e485894bdf30203b53607f1d94e34'
LASTFM_API_SECRET = ''

# Can be "builtin" or "tornado"
SERVER = "tornado"

SERVER_HOST = '127.0.0.1'
SERVER_PORT = 5000

MPD_SERVER = {'host': mpd_local, 'port': 6600}

SECRET_KEY = 'devkey'

Make sure you have a directory in which to put your database file (eg. if you use this file don't forget to mkdir tmp! The gitignore with this project is set to ignore the tmp directory so that's probably the best place to put the database file.

Set up the database

As easy as python partify/database.py. That file also has some functions that you can run from ipython or another REPL to clear and initialize the db.

Build the Javascript

The Javascript that runs in the browser is not included in the repository by default because it is compiled to from a language called Coffeescript. Issue the command make to compile the packaged Coffeescript into Javascript, which is suitable to be interpreted by the browser.

Run the project!

When you have the configuration file and database created, you can run the project by running run.py in a Python interpreter, i.e. python run.py. The application will start using the configuration options specified in config.py.

Clone this wiki locally