Sourcefabric Manuals

 English |  Español |  Français |  Italiano |  Português |  Русский |  Shqip

Booktype 2.3 for Authors and Publishers

Command Line Admin

If you have shell access to the Booktype server, you can use the command line admin tools to perform functions including the export and import of books, and changing the URLs or titles of books. You can do a lot of damage with these tools, so be careful and always make back-ups!

First, change to the Booktype instance directory, then change to the owner of the files (for example, the www-data user in the case of a Debian or Ubuntu server running Apache). Next, load the Booktype environment variables:

cd /var/www/booktype/instance1/
sudo su www-data
. ./booktype.env

You are now ready to use the command line tools.

Generic options

These options are available for all tools:

  -v VERBOSITY, --verbosity=VERBOSITY
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output

  --settings=SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.

  --pythonpath=PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".

  --traceback           Print traceback on exception

  --version             show program's version number and exit

  -h, --help            show this help message and exit

Running the command:

django-admin.py help [command]

prints usage information for any of the following tools.

Editor tools

<book name> takes the same form as the Booktype URL, in lower case with spaces replaced by hyphens. For example, the title "My book" becomes my-book on the command line.

bookexport

Export book contents as a ZIP file. Only the content of one book version will be exported, and you will not get the book history data.

Usage:

django-admin.py bookexport [options] <book name>

Options:

 --book-version=BOOK_VERSION

Book version, e.g. 1.0

 --output=OUTPUT_NAME

Output filename e.g. export-my-book.zip, or -- for STDOUT.

bookrename

Renames a book, moves book to a new URL on the Booktype server, or changes book owner.

Usage:

django-admin.py bookrename [options] <book name>

Options:

--owner=OWNER

Set a new owner of the book. OWNER takes the form of the Booktype user name without spaces, as shown on their profile page, rather than the user's full name.

--new-book-title=NEW_BOOK_TITLE

Set a new book title, where NEW_BOOK_TITLE can contain spaces if enclosed in double quotes, e.g. "My New Book".

--new-book-url=NEW_BOOK_URL

Set a new book URL on the Booktype server. This command only affects the part of the URL to the right of the domain name, e.g. 'my-book' in http://booktype.example.com/my-book

To move a book between Booktype servers, use the bookimport command instead.

brokenlinks

Check links in one or more books.

Usage:

 django-admin.py brokenlinks [options] <book name> [, <book name>, ...]

Options:

--no-remote

Do not check remote URL links.

--no-local

Do not check local links.

--no-cache

Do not cache network links.

--ignore-url=IGNORE_URL

Which host to ignore when checking links. IGNORE_URL takes the form of a URL without quotes, e.g. http://www.wikipedia.org/

User tools

createuser

Create a user on the Booktype system. At least the username, email address, full name and password for the new user must be specified.

Usage:

 django-admin.py createuser [options]

Options:

--username=USERNAME

Specifies the username for the new user.

--email=EMAIL

Specifies the email address for the user.

--fullname=FULLNAME

Specifies the full name for the user. If the full name contains a space, double quotes must be used for FULLNAME, e.g. "A.N. Author".

--password=PASSWORD

Specifies the login password for the user.

--is-superuser

User will have administrator powers. This option grants full control of the Booktype instance, so it should be reserved for trusted persons only.

Report tools

report

Used to send a report from the Booktype server.

Usage:

 django-admin.py report [options]

Options:

--send-email

Send email to admin.

--days=DAYS

The number of days to use when generating the report.

reportweekly

Used to send a weekly report from the Booktype server.

Usage:

django-admin.py reportweekly [options]

Options:

--send-email

Send email to admin.

--days=DAYS

The number of days to use when generating the report.

Import tools

bookimport

Import one or more books from EPUB files. You can also import a book under a new name.

Usage:

django-admin.py bookimport [options] <epub file> [, <epub file>, ...]

Options:

--owner=OWNER

Booktype username of the owner of the imported book.

--new-book-title=NEW_BOOK_TITLE

Title of the new book.

--new-book-url=NEW_BOOK_URL

URL of the new book on the Booktype server.

Troubleshooting

If the creation of book chapters or opening the chapter editor stalls, with a blank page and sometimes with a message in a green dialog box, this can be due to problems with the Redis database. The workaround is to use the command:

sudo redis-cli flushall

which deletes all the keys of all the existing Redis databases. It does not affect the book content in the PostgreSQL database.

There has been error in communication with Booktype server. Not sure right now where is the problem.

You should refresh this page.