Booktype for Authors and Publishers

Installation on OS X

Before installing Booktype on an OS X server, you need to create a suitable environment. You can use the command line tools easy_install to obtain the necessary Python dependencies and Homebrew to install Redis. The page at http://mxcl.github.com/homebrew/ provides instructions for a first time install of Homebrew.

To use Redis you need to install Command Line Tools for Xcode which can be found at the Apple developer web pages (https://developer.apple.com/downloads - you'll need an Apple ID before you are allowed to download), and xcode which can be downloaded using the OS X app store.

After the successful installation of Homebrew, open a terminal and enter the command:

brew install redis

Then install the Python dependencies, with the commands:

easy_install django
easy_install lxml
easy_install pil
easy_install simplejson
easy_install south
easy_install unidecode

Optionally, you can install these Python packages in a virtualenv (Python virtual environment).

Now it's time to install Booktype. To download Booktype from the source code repository you'll need git from http://git-scm.com/download/mac or the native GitHub application from https://central.github.com/mac/latest

Once git is installed, you can download Booktype with:

git clone https://github.com/sourcefabric/Booktype.git

Open another terminal, and enter the command:

redis-server

to run Redis.

Back in the original terminal, where you downloaded Booktype with git, change to the scripts directory and create a Booktype instance called 'mybooki' with the command:

./createbooki --database sqlite $HOME/mybooki

Change to the target directory and edit the settings.py file to suit your installation. In this example we are using a python virtualenv and an sqlite3 database:

DATABASES = {
        'default': {
                'NAME':'/Users/bostjan/peskovnik/virtualenv/booktype/mybooktype/database.sqlite',
                'ENGINE':'django.db.backends.sqlite3',
                'USER': '',
                'PASSWORD' : ''
        }
        }

Then edit TEMPLATE_LOADERS to read:

TEMPLATE_LOADERS = (
        'django.template.loaders.filesystem.Loader',
        'django.template.loaders.app_directories.Loader',
)

Load the environment variables, with the command:

. ./booki.env

Then populate the database with data:

django-admin.py syncdb --noinput
django-admin.py migrate
django-admin.py createsuperuser
django-admin.py loaddata documentation_licenses

If you get an unknown locale: UTF-8 error try the command:

export LC_ALL=en_US.UTF-8; export LANG=en_US.UTF-8

before running the above commands again. Finally, run a test server with:

django-admin.py runserver

Then open http://localhost:8000/ in your web browser to see the test server.