commit 33239add7e2ba5ee049b4d2989f2d08ac3356f7e Author: darthsandmann Date: Tue Oct 11 18:46:02 2016 +0200 README, .bat diff --git a/Praktikum1/test/app/__init__.py b/Praktikum1/test/app/__init__.py new file mode 100644 index 0000000..1546642 --- /dev/null +++ b/Praktikum1/test/app/__init__.py @@ -0,0 +1 @@ +# kennzeichnet ein Verzeichnis als Python-Package \ No newline at end of file diff --git a/Praktikum1/test/app/__init__.pyc b/Praktikum1/test/app/__init__.pyc new file mode 100644 index 0000000..f8e2eca Binary files /dev/null and b/Praktikum1/test/app/__init__.pyc differ diff --git a/Praktikum1/test/app/__pycache__/__init__.cpython-35.pyc b/Praktikum1/test/app/__pycache__/__init__.cpython-35.pyc new file mode 100644 index 0000000..bc82f9e Binary files /dev/null and b/Praktikum1/test/app/__pycache__/__init__.cpython-35.pyc differ diff --git a/Praktikum1/test/app/__pycache__/application.cpython-35.pyc b/Praktikum1/test/app/__pycache__/application.cpython-35.pyc new file mode 100644 index 0000000..c61b452 Binary files /dev/null and b/Praktikum1/test/app/__pycache__/application.cpython-35.pyc differ diff --git a/Praktikum1/test/app/application.py b/Praktikum1/test/app/application.py new file mode 100644 index 0000000..0e0bfda --- /dev/null +++ b/Praktikum1/test/app/application.py @@ -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 \ No newline at end of file diff --git a/Praktikum1/test/app/application.pyc b/Praktikum1/test/app/application.pyc new file mode 100644 index 0000000..6f0f176 Binary files /dev/null and b/Praktikum1/test/app/application.pyc differ diff --git a/Praktikum1/test/content/index.html b/Praktikum1/test/content/index.html new file mode 100644 index 0000000..5a61090 --- /dev/null +++ b/Praktikum1/test/content/index.html @@ -0,0 +1,10 @@ + + + + Titel + + + +

Stellen Sie eine Anfrage an den Testserver: Anfrage

+ + \ No newline at end of file diff --git a/Praktikum1/test/testserver.py b/Praktikum1/test/testserver.py new file mode 100644 index 0000000..2f1c972 --- /dev/null +++ b/Praktikum1/test/testserver.py @@ -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