Skip to content

staircase2/socialbooks

Repository files navigation

---------------------------SocialBooks Installation Guide ---------------------------

Prerequisites

  1. Django svn-trunk release (current: svn-r13444)
  2. Python 2.5 or 2.6 (virtualenv recommended)
  3. MySQL or other supported database (should be able to override in local.py)
Via pip (or easy_install):
  • cssutils
  • python-openid (2.x)
  • python-yadis
  • twill
  • lxml // Using from Ubuntu repos
  • BeautifulSoup
Via Ubuntu Repos:
  • django-south
  • python-lxml

Running setup.py install will install these packages for you. NOTE: setup.py not available as of now. Manually install above packages with pip

Google up the source tarballs for the below packages, and place it into src/ in your project directory. Create src/ if not present. Find the proper source directory (ie. the one with __init__.py) of each download package, and symlink that into the project directory. * minidetector * gdata //using from easy_install

Submodules

Remember to perform the following to initialise the submodules added to this project
  • git submodule init
  • git submodule update
Current submodules:

Setup Django South migrations

./manage.py schemamigration library —initial repeat for library, api, mobile, all apps that have models.py

./manage.py syncdb

after you've done that repeat with ./manage.py migrate <appname>

/** Ignore from this point onwards**/

Database

The first time you get here, manually create the database and user permissions according to values in ./settings.py

create database bookworm default character set = UTF8; //wrong statement. Create using phpmyadmin with charset = utf8 and collation = utf8_general

To set local settings, please write the modified values from settings.py in local.py, do not change settings.py. local.py overwrites the default settings.

Then, from the project root:

python manage.py syncdb //No need to sync superuser creds python manage.py test library --settings=test_settings # Sanity check //test settings not yet ported from bookworm

You should only need to run syncdb initially, or when the schema changes.

Fulltext index

You will need to create this manually after setting up the database:

mysql> create fulltext index epubtext on library_htmlfile (words);

Permissions

By default, Bookworm expects to be able to write to its log directory $PROJECT_ROOT/log and to the storage directory $PROJECT_ROOT/library/storage. You will need to ensure that the web server has write access there.

Cron

There is one required cron job, which updates the indexes and also cleans up book metadata:

$PROJECT_ROOT/search/index.sh

You can run this at whatever frequency you prefer; I do it on the half-hour.

Testing

To test the models and views: python manage.py test library --settings=test_settings

To test the mobile version: python manage.py test mobile --settings=test_settings_mobile

To test the API: python manage.py test api

Development

To run a local development server: python manage.py runserver

To start over with a clean database: clear-db.sh

clear-db takes optional arguments:

  • no arguments clears only the 'library' app
  • 'auth' clears the base Django auth framework
  • 'openid' clears the django_authopenid database
  • 'all' clears all of the above

Other documentation is in docs/