README, .bat

This commit is contained in:
darthsandmann 2016-10-11 18:46:02 +02:00
commit 33239add7e
8 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1 @@
# kennzeichnet ein Verzeichnis als Python-Package

Binary file not shown.

View File

@ -0,0 +1,31 @@
# coding: utf-8
import cherrypy
#--------------------------------------
class Application_cl(object):
#--------------------------------------
#----------------------------------
def __init__(self):
#--------------------------------------
# constructor
pass
@cherrypy.expose
#--------------------------------------
def greeting(self):
#--------------------------------------
return "Cherrypy-Server, Version %s" % cherrypy.__version__
@cherrypy.expose
#--------------------------------------
def default(self, *arglist, **kwargs):
#--------------------------------------
msg_s = "unbekannte Anforderung: " + \
str(arglist) + \
''+\
str(kwargs)
raise cherrypy.HTTPError(404, msg_s)
# EOF

Binary file not shown.

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>Titel</title>
<meta charset="UTF-8" />
</head>
<body>
<p>Stellen Sie eine Anfrage an den Testserver: <a href="greeting">Anfrage</a></p>
</body>
</html>

View File

@ -0,0 +1,38 @@
#coding: utf-8
import os
import cherrypy
from app import application
#--------------------------------------
def main():
#--------------------------------------
# Get current directory
try:
current_dir = os.path.dirname(os.path.abspath(__file__))
except:
current_dir = os.path.dirname(os.path.abspath(sys.executable))
# disable autoreload and timeout_monitor
cherrypy.engine.autoreload.unsubscribe()
cherrypy.engine.timeout_monitor.unsubscribe() # Static content config
static_config = {
'/': {
'tools.staticdir.root': current_dir,
'tools.staticdir.on': True,
'tools.staticdir.dir': './content',
'tools.staticdir.index': 'index.html'
}
}
# Mount static content handler
root_o = cherrypy.tree.mount(application.Application_cl(), '/', static_config) # suppress traceback-info
cherrypy.config.update({'request.show_tracebacks': False})
# Start server
cherrypy.engine.start()
cherrypy.engine.block()
#--------------------------------------
if __name__ == '__main__':
#--------------------------------------
main()
# EOF