MyBookshelf – EBooks Library


MyBookshelf  is web based program to manage your library of ebooks. It is fully web based, with simple, yet powerful interface. It’s written in python language and django web framework offers great flexibility and extensibility. Ideal for sharing ebooks within a group of people.


This project started because my collection of ebooks grew bit larger and I need some way how to manage them.  I look at Calibre, it is a great program with many features, but has one significant issue from my perspective –  ebook can have only one file for given format.   However I do have for some ebooks  many files for one format (as I can get them from various sources) and do want to store them all.  So I decided to create my own solutions, which also should be bit exercise for me in modern web interfaces.

Key design decisions were that it is web based (django), with MySql database backend,  store only small set of ebooks metadata, no covers (purpose is  to find ebook quickly – any extensive metadata can be found on internet), Linux platform, intended to run on my home server and provide services to all my family.

Key features:

  •  Modern web interface with AJAX features (autocomplete etc).
  • Easy search and browing in various dimensions (Author, Title, Category …)
  • Multiple formats supports and multiple files in same format
  • One-click conversion to ebook format (epub, mobi, fb2), even from doc or docx (using LibreOffice and ebook-convert)
  • Ebooks lists (bookshelves) to organize books. Bookshelves can be  created easily as private or shared.
  • Guided ebook upload (minimizes duplications)
  • Can upload compressed files (zip or rar) – will be decompressed automatically
  • Mass import from disk (using command like utility)
  • Extensive user and access rights possibilities (thanks to Django)
  • Admin features (both inline and through Django Admin app)

Mybookshelf can be installed from source only. Code is hosted on launchpad, easiest way to get it is :

bzr checkout --lightweight lp:mybookshelf

this will get just trunk version without history, if you plan to develop, should get rather full branch with history:

bzr branch lp:mybookshelf

All code is available as open source under GPL v3 license.

Bugs should be reported on launchpad.

Mybookshelf will run only on Linux. Installation is manual, here are installation steps (Ubuntu/Debian):

  1. Install dependencies:
    sudo apt-get install apache2 mysql-server python-django python-mysqldb libapache2-mod-wsgi libreoffice libxt6 bzr
    # calibre installed from latest version rather then from distro packages

    sudo python -c "import sys; py3 = sys.version_info[0] > 2; u = __import__('urllib.request' if py3 else 'urllib', fromlist=1); exec(u.urlopen('').read()); main()"
  2. Install Mybookshelp source:
    bzr checkout --lightweight

    (if you consider development of code use bzr brach instead)
    Move file to final destination – like /opt/mybookshelf
    sudo mv mybookshelf/ /opt

  3. Create database:
    mysql -u root
    mysql> create database ebooks;
    Query OK, 1 row affected (0.00 sec)
    mysql> grant all on ebooks.* to 'ebooks'@'localhost' identified by 'ebooks';
    Query OK, 0 rows affected (0.05 sec)
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
  4. Create directories for ebooks:
    mkdir ebooks
    mkdir ebooks/library
    mkdir ebooks/converted
    mkdir ebooks/recon
    chmod -R 0777 ebooks
    last command is to assure that web server user will have write access – if you are concerned about security, you can consider different setup – special security group or something like this
  5. Edit /opt/mybookshelf/
    Set database parameters:
    DATABASE_NAME = 'ebooks'           
    DATABASE_USER = 'ebooks'           
    DATABASE_PASSWORD = 'ebooks'
    Set ebook directories:
    And disable debug toolbar (in MIDDLEWARE_CLASSES and INSTALLED APPS )
  6. Now sync database – e.g. create tables and initial data
    cd /opt/mybookshelf/
    ./ syncdb # also create an admin user!
    ./ loaddata data.xml
  7. Test it
    ./ runserver your_ip:5555
    this runs emended server and try to connect with browser to it. Login as your admin user. Try to upload ebook and convert it.  Then stop this command.
  8. Edit django.wsgi
    set path = '/opt/mybookshelf'
  9. Create new virtual server configuration in /etc/apache2/sites-available:
    <VirtualHost *:5555>
        ServerName localhost
        ServerAlias localhost
        ServerAdmin ivan
        DocumentRoot /opt/mybookshelf
        Alias /robots.txt /opt/mybookshelf/robots.txt
        Alias /favicon.ico /opt/mybookshelf/favicon.ico
        Alias /media/ /usr/share/pyshared/django/contrib/admin/media/
        Alias /site_media/ /opt/mybookshelf/site_media/
        <Directory /opt/mybookshelf>
        Order allow,deny
        Allow from all
       <Directory /usr/share/pyshared/django/contrib/admin/media>
        Order allow,deny
        Allow from all
        WSGIScriptAlias / /opt/mybookshelf/django.wsgi

    And configure also /etc/apache2/ports.conf and put there Listen 5555.
    sudo ln -s /etc/apache2/sites-available/mybookshelf /etc/apache2/sites-enabled/
    sudo apache2ctl restart
    and test again in the browser

My Digital Bits And Pieces