|
|
#1 |
|
Junior Member
![]() ![]() Posts: 5
Karma: 108
Join Date: Sep 2011
Device: SONY PRS-350
|
difficulties getting calibre-server to work with apache/wsgi
I am trying to run calibre-server running behind apache using the wsgi module.
I'm running calibre 0.8.19 on a gentoo x86_64 system, compiled from source. I've followed the instructions online but when I try to load the calibre homepage I get: Code:
500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.
Traceback (most recent call last):
File "/usr/lib/calibre/cherrypy/_cprequest.py", line 587, in respond
self.get_resource(path_info)
File "/usr/lib/calibre/cherrypy/_cprequest.py", line 691, in get_resource
dispatch(path)
File "/usr/lib/calibre/cherrypy/_cpdispatch.py", line 367, in __call__
func = self.find_handler(path_info)
File "/usr/lib/calibre/cherrypy/_cpdispatch.py", line 382, in find_handler
config.environ = cherrypy.request.wsgi_environ
File "/usr/lib/calibre/routes/__init__.py", line 22, in __setattr__
self.load_wsgi_environ(value)
File "/usr/lib/calibre/routes/__init__.py", line 51, in load_wsgi_environ
result = mapper.routematch(path)
File "/usr/lib/calibre/routes/mapper.py", line 686, in routematch
raise RoutesException('URL or environ must be provided')
RoutesException: URL or environ must be provided
Here is the apache error log after starting and attempting to load the calibre home page: Code:
[Thu Sep 22 17:27:44 2011] [notice] mod_python: Creating 8 session mutexes based on 150 max processes and 0 max threads. [Thu Sep 22 17:27:44 2011] [notice] mod_python: using mutex_directory /tmp [Thu Sep 22 17:27:44 2011] [notice] Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/1.0.0e mod_python/3.3.1 Python/2.7.1 mod_wsgi/3.3 configured -- resuming normal operations Here is my wsgi script: Code:
# CALIBRE_RESOURCES_PATH
sys.resources_location = '/usr/share/calibre'
# CALIBRE_EXTENSIONS_PATH
sys.extensions_location = '/usr/lib/calibre/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='/data/Calibre/Calibre-main'
)
del create_wsgi_app
BTW, I have no problems running the calibre server using the calibre-server command and I also have no problems reverse proxying using apache. So this is far from being a deal-breaker for me but I'd love to have just one web server running on my server at home. |
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,597
Karma: 28548962
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That's caused by a bug in python routes where the empty url doesn't work. Use /calibre/ (note the trailing slash) or /calibre/browse to access the server instead.
Last edited by kovidgoyal; 09-23-2011 at 02:51 PM. |
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Junior Member
![]() ![]() Posts: 5
Karma: 108
Join Date: Sep 2011
Device: SONY PRS-350
|
Thanks!! that did it.
Related to this, I think I found a bug. When I set prefix=/ebooks or whatever, and use /ebooks/ to get to the home page the links to the categories always get prefixed with /calibre instead of /ebooks resulting in page not found. But when I go to /ebooks/browse, the prefixing works. Seems specific to running with wsgi as I haven't noticed this problem with reverse proxying. Thanks for all the work going into calibre!! My Sony reader would be worth a lot less without it
|
|
|
|
|
|
#4 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,597
Karma: 28548962
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I cannot reproduce that. Going to
http://localhost/wsgi/ and clicking on Tags takes me to http://localhost/wsgi/browse/category/tags |
|
|
|
|
|
#5 |
|
Junior Member
![]() ![]() Posts: 5
Karma: 108
Join Date: Sep 2011
Device: SONY PRS-350
|
Hmm,
the problem went away for me as well. Maybe some kind issue with caching by my browser? Anyway, thanks a bunch for the help! |
|
|
|
| Advert | |
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP+Apache web server for calibre ... | chaley | Related Tools | 254 | 04-28-2014 08:18 PM |
| Content server apache reverse proxy issue | bossanova808 | Calibre | 13 | 09-16-2011 09:38 AM |
| Content Server with Apache Reverse Proxy | Caleb666 | Calibre | 1 | 08-29-2011 04:20 PM |
| calibre, apache, mod_python content server | rupa | Calibre | 0 | 12-26-2010 10:29 AM |
| Calibre web server on MAC I cant get to work.. any help appreciated. | stustaff | Calibre | 5 | 01-06-2010 06:05 PM |