mirror of
https://github.com/janeczku/calibre-web
synced 2024-10-31 15:20:28 +00:00
b70191ca2a
change some syntax - except clause - unicode -> bulitins.str - sqllite uri - fix import local path - 01 to 1 (0 is meaningless) add module - future - builtins (from future) - imp (python3 ) - past (from future) - sqlalchemy (update one) refer to http://python-future.org/compatible_idioms.html
32 lines
967 B
Python
Executable File
32 lines
967 B
Python
Executable File
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
import sys
|
|
|
|
base_path = os.path.dirname(os.path.abspath(__file__))
|
|
# Insert local directories into path
|
|
sys.path.append(base_path)
|
|
sys.path.append(os.path.join(base_path, 'cps'))
|
|
sys.path.append(os.path.join(base_path, 'vendor'))
|
|
|
|
from cps import web
|
|
from tornado.wsgi import WSGIContainer
|
|
from tornado.httpserver import HTTPServer
|
|
from tornado.ioloop import IOLoop
|
|
|
|
if __name__ == '__main__':
|
|
if web.ub.DEVELOPMENT:
|
|
web.app.run(host="0.0.0.0", port=web.ub.config.config_port, debug=True)
|
|
else:
|
|
http_server = HTTPServer(WSGIContainer(web.app))
|
|
http_server.listen(web.ub.config.config_port)
|
|
IOLoop.instance().start()
|
|
|
|
if web.helper.global_task == 0:
|
|
web.app.logger.info("Performing restart of Calibre-web")
|
|
os.execl(sys.executable, sys.executable, *sys.argv)
|
|
else:
|
|
web.app.logger.info("Performing shutdown of Calibre-web")
|
|
sys.exit(0)
|