add templates and modules + connect to load pages using url (/section/)..TODO: comments and PEP8
This commit is contained in:
@@ -1,23 +1,43 @@
|
|||||||
|
#Comments and PEP8 format TODO
|
||||||
import cherrypy
|
import cherrypy
|
||||||
|
import os
|
||||||
|
|
||||||
#from modules import index
|
from modules import select
|
||||||
#from modules import select
|
from modules import delete
|
||||||
#from modules import delete
|
from modules import insert
|
||||||
#from modules import insert
|
from modules import create
|
||||||
#from modules import create
|
from modules import drop
|
||||||
#from modules import drop
|
from modules import index
|
||||||
from modules import *
|
|
||||||
|
SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
|
||||||
class main_server_loop(object):
|
class main_server_loop(object):
|
||||||
server_config = {
|
cherrypy.config.update({'server.socket_host': '127.0.0.1',
|
||||||
'server_socket_host': '127.0.0.1',
|
'server.socket_port': 80,
|
||||||
'server_socket_port': 80
|
})
|
||||||
}
|
conf = {
|
||||||
cherrypy.config.update(server_config)
|
'/': {
|
||||||
@cherrypy.expose
|
'tools.sessions.on': True,
|
||||||
def index(self):
|
'tools.staticdir.root': os.path.abspath(SCRIPT_PATH + '/')
|
||||||
return "Hello World!"
|
},
|
||||||
|
'/static': {
|
||||||
|
'tools.staticdir.on': True,
|
||||||
|
'tools.staticdir.dir': './static'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cherrypy.tree.mount(index.wellcome(), "/", conf)
|
||||||
|
cherrypy.tree.mount(select.select(), "/select", conf)
|
||||||
|
cherrypy.tree.mount(delete.delete(), "/delete", conf)
|
||||||
|
cherrypy.tree.mount(insert.insert(), "/insert", conf)
|
||||||
|
cherrypy.tree.mount(create.create(), "/create", conf)
|
||||||
|
cherrypy.tree.mount(drop.drop(), "/drop", conf)
|
||||||
|
cherrypy.engine.start()
|
||||||
|
|
||||||
|
|
||||||
cherrypy.quickstart(main_server_loop())
|
if __name__ == '__main__':
|
||||||
|
try:
|
||||||
|
main_server_loop()
|
||||||
|
except Exception as e:
|
||||||
|
raise e
|
||||||
Reference in New Issue
Block a user