Skip to content

aristippe/pathagar

 
 

Repository files navigation

Introduction

Pathagar is a simple book server for schools where there is little or no internet. For more information, see this presentation by Prof. Sameer Verma. To get involved, please join our mailing list. For some of the history of the project, read this blogpost at OLPC-SF

Setting up Pathagar using Fabric (BETA)

Fabric is the most convenient way to setup Pathagar on your server.

To setup pathagar using fabric you first need to install Fabric and Virtualenv.

Note: If you are running a red-hat based machine. Replace "ubuntu" in the following commands/paths to fedora and follow the same procedure.

After installing edit deploy/ubuntu/fabric.py , deploy/ubuntu/settings.conf and deploy/ubuntu/virtualhost.conf to configure the server according to your needs.

Great! Now you are ready to deploy.

First we need to create the directories that will hold pathagar's code, logs and environment. To do this run the following command:

fab ubuntu bootstrap

Now we need to configure apache and let it know about the location of the files. To do that run:

fab ubuntu deploy

Perfect! Now we have apache running our server through mod_wsgi. Now we need to setup our databases.

fab ubuntu create_db

fab ubuntu setup_db

Done! You should now have a working instance of pathagar running on your server.

Please note that our fabric scripts are still under beta. If you come across any problems please feel free to ask for help.

OPDS

It uses the OPDS spec:

http://opds-spec.org

Books can be added via the admin interface, as well as via the command line, in batch (using CSV files, JSON files or a directory with EPUB files), through the command:

python manage.py addbooks

        OR
        
python manage.py addepub

Pathagar runs on the python web app framework Django.

Format of CSV file

To add books from a CSV file:

python manage.py addbooks books.csv

The format of the CSV file is like: "Path to ebook file","Title","Author","Description"

If you need to add more fields, please use the JSON file.

Format of JSON file

To add books from a JSON file:

python manage.py addbooks --json books.json

The format of the JSON file is like::

[
  {
    "book_path": "Path to ebook file",
    "cover_path": "Path to cover image",
    "title": "Title",
    "authors": "Author",
    "a_status": "Published",
    "summary": "Description",
    "tags": "set, of, tags"
  },
  ...
]

You can add more fields. Please refer to the Book model.

Dependencies

  • Python
  • Django
  • django-taggit
  • django-sendfile
  • django-contrib-comments
  • django-formtools
  • Pillow

Quickstart

  • Install mysql

In Fedora

$ sudo yum install -y mysql mysql-devel
  • Install requirements
    $ pip install -r requirements.txt
  • In the Pathagar pathagar/ folder copy local_settings.py.sample to local_settings.py, and edit it to suite your needs and environment.
    $ cd pathagar
    pathagar$ cp local_settings.py.sample local_settings.py
    (edit local_setting.py)
  • In the Pathagar root folder, run the command for creating the database and importing initial data.
    $ python manage.py migrate
    $ python manage.py loaddata books/fixtures/initial_data.json
  • Add an admin user in order to be able to login into the application.
    $ python manage.py createsuperuser
  • To run the server, run
    $ python manage.py runserver

This starts a server listening on localhost, port 8000

If the port 8000 is in use, can change the port (by example to 8081) running

    $ python manage.py runserver 0.0.0.0:8081
  • With your browser, access http://localhost:8000 and see if the index page comes up. If it comes up, click on "Add books" in the footer to start adding books. You will be asked for a username/password. This is the admin username/password you supplied while running createsuperuser.

    NOTE: You can also mass add books via the command line through CSV files or by simply pointing to a directory with a set of EPUB files.

  • To run the server in a production environment, look at Django deployment docs at : http://docs.djangoproject.com/en/1.8/howto/deployment/

About

Pathagar is a simple bookserver serving OPDS feeds

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 77.8%
  • HTML 17.4%
  • CSS 3.6%
  • Other 1.2%