Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
server.request = restRequest
cherrypy.server.unsubscribe()
cherrypy.config.update({'environment': 'embedded',
'log.screen': False,
'request.throw_errors': True})
cherrypy.engine.start()
yield server
cherrypy.engine.unsubscribe('start', girder.events.daemon.start)
cherrypy.engine.unsubscribe('stop', girder.events.daemon.stop)
cherrypy.engine.stop()
cherrypy.engine.exit()
cherrypy.tree.apps = {}
cherrypy.tree.girder_app = None
plugin_utilities.getPluginDir = oldPluginDir
plugin_utilities.getPluginWebroots().clear()
plugin_utilities.getPluginFailureInfo().clear()
docs.routes.clear()
def setUpModule():
global model, test_server, fake_iso
cherrypy.request.headers = {'Accept': 'application/json'}
patch_auth()
test_server = run_server(test_mode=True)
model = cherrypy.tree.apps['/plugins/kimchi'].root.model
fake_iso = '/tmp/fake.iso'
iso_gen.construct_fake_iso(fake_iso, True, '12.04', 'ubuntu')
parser = argparse.ArgumentParser()
parser.add_argument("--daemon", help="Run as daemon process",
action="store_true")
parser.add_argument("--port", type=int, help="Listen port (default 6969)")
args = parser.parse_args()
engine = cherrypy.engine
if args.daemon:
Daemonizer(engine).subscribe()
cleanup()
cherrypy.log = IgnoreStatusLogger()
cherrypy.tree.mount(Api(), '/api')
cherrypy.tree.mount(Html(), '/', config = {
'/': {
'tools.staticdir.on': True,
'tools.staticdir.dir': locations.HTML_PATH,
'tools.staticdir.index': 'index.html',
},
})
def exit():
os.system('stty sane')
engine.signal_handler.bus.exit()
engine.signal_handler.handlers['SIGINT'] = exit
engine.signal_handler.handlers['SIGUSR2'] = engine.signal_handler.bus.restart
cherrypy.config.update({'server.socket_host': '0.0.0.0'})
port = 6969
if args.port:
def run(self):
cherrypy.config.update({
'server.socket_host': HOST,
'server.socket_port': PORT,
'engine.autoreload.on': False,
'log.screen': True
})
self.mount_static(settings.STATIC_URL, settings.STATIC_ROOT)
#cherrypy.process.plugins.PIDFile(cherrypy.engine, os.path.join(settings.BASE_DIR, 'IRCapp.pid')).subscribe()
cherrypy.log("Loading and serving IRCapp")
cherrypy.tree.graft(WSGIHandler())
cherrypy.engine.start()
obj = Download_Settings.objects.latest('id')
if not obj.restart:
t = threading.Thread(target=self.open_browser())
t.deamon = True
t.start()
else:
obj.restart = False
obj.save()
cherrypy.engine.block()
def run(self, host='127.0.0.1', port=8888, blocking=False):
cherrypy.config.update({
'server.socket_host': host,
'server.socket_port': port
})
cherrypy.tree.mount(self, '/', {
'/__src__':
{
'tools.staticdir.on': True,
'tools.staticdir.dir': os.path.abspath(self.jasmine_config.src_dir())
},
'/__spec__':
{
'tools.staticdir.on': True,
'tools.staticdir.dir': os.path.abspath(self.jasmine_config.spec_dir())
}
}
)
cherrypy.engine.signals.subscribe
cherrypy.engine.start()
if blocking:
cherrypy.engine.block()
cherrypy.config.update({
'server.socket_host': config.config['global']['host'],
'server.socket_port': int(config.config['global']['port']),
'request.show_tracebacks' : False,
'environment': 'production',
'log.access_file' : os.path.join(config.config['global']['logs_directory'], 'access.log'),
'log.error_file' : os.path.join(config.config['global']['logs_directory'], 'error.log'),
'log.screen': False,
'tools.sessions.on': True,
'tools.sessions.name': "ODR-Encoder-Manager",
'tools.encode.on': True,
'tools.encode.encoding': "utf-8"
})
cherrypy.tree.mount(
Root(cli_args.config), config={
'/': {
},
'/css': {
'tools.staticdir.on': True,
'tools.staticdir.dir': os.path.join(config.config['global']['static_directory'], u"css/"),
'tools.gzip.on' : True,
'tools.expires.on' : True,
'tools.expires.secs' : 0
},
'/js': {
'tools.staticdir.on': True,
'tools.staticdir.dir': os.path.join(config.config['global']['static_directory'], u"js/"),
'tools.gzip.on' : True,
'tools.expires.on' : True,
'tools.expires.secs' : 0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
import cherrypy
PATH = os.path.abspath(os.path.dirname(__file__))
class Root(object): pass
cherrypy.server.socket_port = 8000
cherrypy.server.socket_host = '0.0.0.0'
cherrypy.tree.mount(Root(), '/', config={
'/': {
'tools.staticdir.on': True,
'tools.staticdir.dir': PATH,
'tools.staticdir.index': 'predDB.html',
},
})
# cherrypy.quickstart()
cherrypy.engine.start()
cherrypy.engine.block()
}
# Parse config
op = optparse.OptionParser()
op.add_option("-p", "--port", dest="server.socket_port", help="listening port",
type="int", metavar="NUMBER")
op.add_option("-s", "--session-path", dest="tools.sessions.storage_path",
help="directory used for session storage", metavar="DIR")
(o, args) = op.parse_args(argv[1:])
o = vars(o)
for k in o.keys():
if o[k] == None:
del(o[k])
# Setup and run cherrypy
cherrypy.tree.mount(Root())
cherrypy.config.update(config=DEFAULT_CONFIG)
if os.path.exists(os.path.join(os.path.dirname(
os.path.dirname(__file__)),'openerp-web.cfg')):
cherrypy.config.update(os.path.join(os.path.dirname(
os.path.dirname(__file__)),'openerp-web.cfg'))
if os.path.exists(os.path.expanduser('~/.openerp_webrc')):
cherrypy.config.update(os.path.expanduser('~/.openerp_webrc'))
cherrypy.config.update(o)
if not os.path.exists(cherrypy.config['tools.sessions.storage_path']):
os.mkdir(cherrypy.config['tools.sessions.storage_path'], 0700)
cherrypy.server.subscribe()
cherrypy.engine.start()
cherrypy.engine.block()
def _create_rest_server(self):
cherrypy.server.socket_host = self.serverIP
cherrypy.server.socket_port = self.serverPort
d = vdsm_cpDispatcher()
cherrypy.tools.delete_no_body = cherrypy.Tool('before_request_body',
delete_no_body)
conf = {'/': {'request.dispatch': d,
'engine.autoreload.on': False,
'tools.trailing_slash.on': False,
'tools.delete_no_body.on': True,
'request.methods_with_bodies':
('POST', 'PUT', 'DELETE')}}
obj = Controller.Root(self.cif, self.log, self.templatePath)
cherrypy.tree.mount(obj, '/api', config=conf)
**{'tools.staticfile.filename': os.path.join(baseDir, "static",
versioned_asset.replace("/", os.sep))}, )
}
)
env.globals['url'] = kitana.template_url
env.globals['static'] = kitana.static_url
env.globals["render_messages"] = render_messages
if kitana.running_as != "git":
Monitor(cherrypy.engine, lambda: update_check(kitana), frequency=3600 * 6, name="UpdateCheck").subscribe()
update_check(kitana)
cherrypy.engine.start()
cherrypy.engine.publish('compile_sass')
cherrypy.tree.mount(kitana, prefix, conf)
cherrypy.engine.signals.subscribe()
cherrypy.engine.block()