Manual de usuario de calibre, Publicación 2.73.0
ayuda para depurar problemas relacionados con servidores en proceso.
Primero, debemos crear un adaptador WSGI para el servidor de contenidos de calibre. Aquí hay una plantilla que
puede utilizar para dicho propósito. Reemplace las rutas de acceso como se indica en los comentarios.
# WSGI script file to run calibre content server as a WSGI app
import sys, os
# You can get the paths referenced here by running
# calibre-debug --paths
# on your server
# The first entry from CALIBRE_PYTHON_PATH
sys.path.insert(0, '/home/kovid/work/calibre/src')
# CALIBRE_RESOURCES_PATH
sys.resources_location = '/home/kovid/work/calibre/resources'
# CALIBRE_EXTENSIONS_PATH
sys.extensions_location = '/home/kovid/work/calibre/src/calibre/plugins'
# Path to directory containing calibre executables
sys.executables_location = '/usr/bin'
# Path to a directory for which the server has read/write permissions
# calibre config will be stored here
os.environ['CALIBRE_CONFIG_DIRECTORY'] = '/var/www/localhost/calibre-config'
del sys
del os
from calibre.library.server.main import create_wsgi_app
application = create_wsgi_app(
# The mount point of this WSGI application (i.e. the first argument to
# the WSGIScriptAlias directive). Set to empty string is mounted at /
prefix='/calibre',
# Path to the calibre library to be served
# The server process must have write permission for all files/dirs
# in this directory or BAD things will happen
path_to_library='/home/kovid/documents/demo library',
# The virtual library (restriction) to be used when serving this
# library.
virtual_library=None
)
del create_wsgi_app
Guarde este adaptador como calibre-wsgi-adapter.py en algún lugar al que el servidor tenga acceso.
Supongamos que queremos usar WSGI en Apache. En primer lugar, habilite WSGI en Apache añadiendo lo siguiente
a httpd.conf:
LoadModule wsgi_module modules/mod_wsgi.so
1.9. Cursillos
185