Added simple file for use cherrypy how wsgi server
This commit is contained in:
parent
07bd474563
commit
e3babdd726
2 changed files with 53 additions and 4 deletions
52
paramecio/cherry.py
Normal file
52
paramecio/cherry.py
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
# Import your application as:
|
||||||
|
# from wsgi import application
|
||||||
|
# Example:
|
||||||
|
|
||||||
|
from index import application
|
||||||
|
from settings import config
|
||||||
|
|
||||||
|
# Import CherryPy
|
||||||
|
import cherrypy
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
cherrypy.config.update({'engine.autoreload.on': config.reloader})
|
||||||
|
|
||||||
|
# Mount the application
|
||||||
|
cherrypy.tree.graft(application, "/")
|
||||||
|
|
||||||
|
# Unsubscribe the default server
|
||||||
|
cherrypy.server.unsubscribe()
|
||||||
|
|
||||||
|
# Instantiate a new server object
|
||||||
|
server = cherrypy._cpserver.Server()
|
||||||
|
|
||||||
|
# Configure the server object
|
||||||
|
server.socket_host = "0.0.0.0"
|
||||||
|
server.socket_port = 8080
|
||||||
|
server.thread_pool = 10
|
||||||
|
|
||||||
|
# For SSL Support
|
||||||
|
# server.ssl_module = 'pyopenssl'
|
||||||
|
# server.ssl_certificate = 'ssl/certificate.crt'
|
||||||
|
# server.ssl_private_key = 'ssl/private.key'
|
||||||
|
# server.ssl_certificate_chain = 'ssl/bundle.crt'
|
||||||
|
|
||||||
|
# Subscribe this server
|
||||||
|
server.subscribe()
|
||||||
|
|
||||||
|
# Example for a 2nd server (same steps as above):
|
||||||
|
# Remember to use a different port
|
||||||
|
|
||||||
|
# server2 = cherrypy._cpserver.Server()
|
||||||
|
|
||||||
|
# server2.socket_host = "0.0.0.0"
|
||||||
|
# server2.socket_port = 8081
|
||||||
|
# server2.thread_pool = 30
|
||||||
|
# server2.subscribe()
|
||||||
|
|
||||||
|
# Start the server engine (Option 1 *and* 2)
|
||||||
|
|
||||||
|
cherrypy.engine.start()
|
||||||
|
cherrypy.engine.block()
|
||||||
|
|
||||||
|
|
@ -23,11 +23,8 @@ def make_url(path, query_args={}):
|
||||||
"""
|
"""
|
||||||
This is a method for create urls for the system
|
This is a method for create urls for the system
|
||||||
|
|
||||||
|
|
||||||
Keyword arguments:
|
Keyword arguments:
|
||||||
module -- The module where search code to execute
|
path -- The path to the module
|
||||||
controller -- The controller where search code to execute
|
|
||||||
method -- The method to execute
|
|
||||||
query_args -- a ser of get variables for add to url
|
query_args -- a ser of get variables for add to url
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue