README, .bat
This commit is contained in:
commit
33239add7e
1
Praktikum1/test/app/__init__.py
Normal file
1
Praktikum1/test/app/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
# kennzeichnet ein Verzeichnis als Python-Package
|
BIN
Praktikum1/test/app/__init__.pyc
Normal file
BIN
Praktikum1/test/app/__init__.pyc
Normal file
Binary file not shown.
BIN
Praktikum1/test/app/__pycache__/__init__.cpython-35.pyc
Normal file
BIN
Praktikum1/test/app/__pycache__/__init__.cpython-35.pyc
Normal file
Binary file not shown.
BIN
Praktikum1/test/app/__pycache__/application.cpython-35.pyc
Normal file
BIN
Praktikum1/test/app/__pycache__/application.cpython-35.pyc
Normal file
Binary file not shown.
31
Praktikum1/test/app/application.py
Normal file
31
Praktikum1/test/app/application.py
Normal 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
|
BIN
Praktikum1/test/app/application.pyc
Normal file
BIN
Praktikum1/test/app/application.pyc
Normal file
Binary file not shown.
10
Praktikum1/test/content/index.html
Normal file
10
Praktikum1/test/content/index.html
Normal 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>
|
38
Praktikum1/test/testserver.py
Normal file
38
Praktikum1/test/testserver.py
Normal 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
|
Loading…
x
Reference in New Issue
Block a user