diff --git a/main/modules/__pycache__/create.cpython-37.pyc b/main/modules/__pycache__/create.cpython-37.pyc new file mode 100644 index 0000000..a19dabf Binary files /dev/null and b/main/modules/__pycache__/create.cpython-37.pyc differ diff --git a/main/modules/__pycache__/delete.cpython-37.pyc b/main/modules/__pycache__/delete.cpython-37.pyc new file mode 100644 index 0000000..91f6df3 Binary files /dev/null and b/main/modules/__pycache__/delete.cpython-37.pyc differ diff --git a/main/modules/__pycache__/drop.cpython-37.pyc b/main/modules/__pycache__/drop.cpython-37.pyc new file mode 100644 index 0000000..c286a24 Binary files /dev/null and b/main/modules/__pycache__/drop.cpython-37.pyc differ diff --git a/main/modules/__pycache__/index.cpython-37.pyc b/main/modules/__pycache__/index.cpython-37.pyc new file mode 100644 index 0000000..e6ffd50 Binary files /dev/null and b/main/modules/__pycache__/index.cpython-37.pyc differ diff --git a/main/modules/__pycache__/insert.cpython-37.pyc b/main/modules/__pycache__/insert.cpython-37.pyc new file mode 100644 index 0000000..efc6054 Binary files /dev/null and b/main/modules/__pycache__/insert.cpython-37.pyc differ diff --git a/main/modules/__pycache__/select.cpython-37.pyc b/main/modules/__pycache__/select.cpython-37.pyc new file mode 100644 index 0000000..2025e6d Binary files /dev/null and b/main/modules/__pycache__/select.cpython-37.pyc differ diff --git a/main/modules/create.py b/main/modules/create.py new file mode 100644 index 0000000..760338f --- /dev/null +++ b/main/modules/create.py @@ -0,0 +1,13 @@ +import cherrypy + + +class create(object): + @cherrypy.expose + def index(self): + ''' Method for open specific html file + and change it''' + with open('templates/create.html') as fh: + index_f = fh.read() + result = index_f.format(_title='create_strana', _heading='create') + fh.close() + return result diff --git a/main/modules/delete.py b/main/modules/delete.py new file mode 100644 index 0000000..4cfb52e --- /dev/null +++ b/main/modules/delete.py @@ -0,0 +1,13 @@ +import cherrypy + + +class delete(object): + @cherrypy.expose + def index(self): + ''' Method for open specific html file + and change it''' + with open('templates/delete.html') as fh: + index_f = fh.read() + result = index_f.format(_title='delete_strana', _heading='delete') + fh.close() + return result diff --git a/main/modules/drop.py b/main/modules/drop.py new file mode 100644 index 0000000..9c2c026 --- /dev/null +++ b/main/modules/drop.py @@ -0,0 +1,13 @@ +import cherrypy + + +class drop(object): + @cherrypy.expose + def index(self): + ''' Method for open specific html file + and change it''' + with open('templates/drop.html') as fh: + index_f = fh.read() + result = index_f.format(_title='drop_strana', _heading='drop') + fh.close() + return result diff --git a/main/modules/index.py b/main/modules/index.py new file mode 100644 index 0000000..b89c8c7 --- /dev/null +++ b/main/modules/index.py @@ -0,0 +1,13 @@ +import cherrypy + + +class wellcome(object): + @cherrypy.expose + def index(self): + ''' Method for open specific html file + and change it''' + with open('templates/index.html') as fh: + index_f = fh.read() + result = index_f.format(_title='Titulni_strana', _heading='Vítejte!') + fh.close() + return result diff --git a/main/modules/insert.py b/main/modules/insert.py new file mode 100644 index 0000000..ff6b04f --- /dev/null +++ b/main/modules/insert.py @@ -0,0 +1,13 @@ +import cherrypy + + +class insert(object): + @cherrypy.expose + def index(self): + ''' Method for open specific html file + and change it''' + with open('templates/insert.html') as fh: + index_f = fh.read() + result = index_f.format(_title='insert_strana', _heading='insert') + fh.close() + return result diff --git a/main/modules/select.py b/main/modules/select.py new file mode 100644 index 0000000..88e0700 --- /dev/null +++ b/main/modules/select.py @@ -0,0 +1,13 @@ +import cherrypy + + +class select(object): + @cherrypy.expose + def index(self): + ''' Method for open specific html file + and change it''' + with open('templates/select.html') as fh: + index_f = fh.read() + result = index_f.format(_title='select_strana', _heading='select') + fh.close() + return result diff --git a/main/server.py b/main/server.py new file mode 100644 index 0000000..c310632 --- /dev/null +++ b/main/server.py @@ -0,0 +1,59 @@ +import cherrypy +import os + +from modules import select +from modules import delete +from modules import insert +from modules import create +from modules import drop +from modules import index + +SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) + + +class main_server_loop(object): + ''' Main class for start cherrypy server + + Settings for server socket port and how are sub-modules + called and mounted to their respective paths + + Args: + *None* + + Sets: + *conf:* dict(), per-application configuration + + Returns: + *N/A* + + Raises: + *Exception* Server is unable to start + + ''' + + cherrypy.config.update({'server.socket_port': 80}) + conf = { + '/': { + 'tools.sessions.on': True, + 'tools.staticdir.root': os.path.abspath(SCRIPT_PATH + '/') + }, + '/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() + + +if __name__ == '__main__': + try: + main_server_loop() + except Exception as e: + raise e diff --git a/main/templates/create.html b/main/templates/create.html new file mode 100644 index 0000000..d3eefd1 --- /dev/null +++ b/main/templates/create.html @@ -0,0 +1,10 @@ + + + {_title} + + +
+

{_heading}

+
+ + \ No newline at end of file diff --git a/main/templates/delete.html b/main/templates/delete.html new file mode 100644 index 0000000..d3eefd1 --- /dev/null +++ b/main/templates/delete.html @@ -0,0 +1,10 @@ + + + {_title} + + +
+

{_heading}

+
+ + \ No newline at end of file diff --git a/main/templates/drop.html b/main/templates/drop.html new file mode 100644 index 0000000..d3eefd1 --- /dev/null +++ b/main/templates/drop.html @@ -0,0 +1,10 @@ + + + {_title} + + +
+

{_heading}

+
+ + \ No newline at end of file diff --git a/main/templates/index.html b/main/templates/index.html new file mode 100644 index 0000000..61d54cc --- /dev/null +++ b/main/templates/index.html @@ -0,0 +1,25 @@ + + + {_title} + + +
+

{_heading}

+
+
+

For select page click HERE

+
+
+

For delete page click HERE

+
+
+

For insert page click HERE

+
+
+

For create page click HERE

+
+
+

For drop page click HERE

+
+ + \ No newline at end of file diff --git a/main/templates/insert.html b/main/templates/insert.html new file mode 100644 index 0000000..d3eefd1 --- /dev/null +++ b/main/templates/insert.html @@ -0,0 +1,10 @@ + + + {_title} + + +
+

{_heading}

+
+ + \ No newline at end of file diff --git a/main/templates/select.html b/main/templates/select.html new file mode 100644 index 0000000..d3eefd1 --- /dev/null +++ b/main/templates/select.html @@ -0,0 +1,10 @@ + + + {_title} + + +
+

{_heading}

+
+ + \ No newline at end of file