From 3035389d1f509db138103c349a1903a87bd0fbe6 Mon Sep 17 00:00:00 2001 From: darthsandmann Date: Tue, 11 Oct 2016 18:46:02 +0200 Subject: [PATCH] Aufgabenstellung --- Praktikum1/test/app/__init__.py | 1 + Praktikum1/test/app/__init__.pyc | Bin 0 -> 147 bytes .../app/__pycache__/__init__.cpython-35.pyc | Bin 0 -> 143 bytes .../__pycache__/application.cpython-35.pyc | Bin 0 -> 928 bytes Praktikum1/test/app/application.py | 31 ++++++++++++++ Praktikum1/test/app/application.pyc | Bin 0 -> 1147 bytes Praktikum1/test/content/index.html | 10 +++++ Praktikum1/test/testserver.py | 38 ++++++++++++++++++ 8 files changed, 80 insertions(+) create mode 100644 Praktikum1/test/app/__init__.py create mode 100644 Praktikum1/test/app/__init__.pyc create mode 100644 Praktikum1/test/app/__pycache__/__init__.cpython-35.pyc create mode 100644 Praktikum1/test/app/__pycache__/application.cpython-35.pyc create mode 100644 Praktikum1/test/app/application.py create mode 100644 Praktikum1/test/app/application.pyc create mode 100644 Praktikum1/test/content/index.html create mode 100644 Praktikum1/test/testserver.py 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 0000000000000000000000000000000000000000..f8e2eca64e7c5d7f6cd64dbd7a36859d64d683f5 GIT binary patch literal 147 zcmZSn%*(Z&@o#uC0~9a-<_8>n1 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..bc82f9e94805cfd9ba80de58dfbcbf506c293d85 GIT binary patch literal 143 zcmWgR<>gw>_&3~;fq~&M5W@i@kmUfx#VkM~g@GYhlhJP_LlH@kvb54|jFa4=75^F3HR;%{A07Ni8nXPb?_VkB`sH%PfhH*DI*J T#bJ}1pHiBWY6mj47>F4F3wk1L literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..c61b452ba6b26c149c10310e6424371b72118d59 GIT binary patch literal 928 zcmZuv&2G~`5T3Q2I8BpENRS|L$ps`!Pz$LigrKD=<$yw^6e{_$a_ntz;@D<)4I~N| z!i768!2@yel@qUkgv5*;Lt9v7CbP5SZ@&5Ib-V4))~~Z~2Ecc?a4fXX@l@W zi#%%vUbA+hzgatN2yM*MDs~RCERF(SM`^-?IA91)hyF zEV0nRZRHq6E7&|2+nnPwy>RX@N#*{nPB!pbv?fvr9VL?;yj2Vv|1hj${xBpYYSRn) zXb)AzaD~HW(8sCuk?+bVZy!w145sBytV~!N@UfgQZo_bSGf&21<|m03gM;Kem7$P% zGI=m4Ao_xHa?HY1T1p#p6kE?uPfw1dOr>L$#dx+aCvl{7(VV?QQ+bWKns9ZsNIMkg zeje-VM7N0w>}#ycmc1*J*n|yne{gb%KNp-AZO-Run8##yIDeD-arGhzsbba?@3RzF zWs5x2$qNk1b)sHNnkf}hQs|f+>qfKmIpzi>9ZyA|OW*$hiq^x5$s@unht;uu1FkyD A00000 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..6f0f1768c76147846bc396d0f279118a2b2dba09 GIT binary patch literal 1147 zcmcIi!EVz)5FOh|N=u6bLKKNhE+8KO3kfa=0WGTFfI{UIDsovl&L-W&v8~++P$^s} z7w-HiX9RE7N&5q>0;cN#O_`}Bp;o&E}3N}ak$CVvvyC^5myFkG*{RTTfZI+ylZ7N^hgm`y!ba-HGW&PUu zHt+`QnVl5IF?XQPzT)P%4R!7&%3X4wB;81lvqizTp*l%P8#jZUAQsnZLCS2dm15Zt zrRLRWQQ(@&4m4!sFa52qoKB_CbQ|KLP_JFax~707Da)7Hi8foeI=;0RRaC>N&e;cE TK>@xUFPa9t^y8EsY`6Xch}`*z literal 0 HcmV?d00001 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