2020-07-13 14:39:43 +00:00
|
|
|
from os.path import abspath
|
|
|
|
from os import getcwd
|
|
|
|
from pathlib import Path
|
2020-07-07 19:46:45 +00:00
|
|
|
|
2020-07-13 14:39:43 +00:00
|
|
|
from bottle import route, run, static_file
|
|
|
|
|
|
|
|
@route("/")
|
2020-07-07 19:46:45 +00:00
|
|
|
def index():
|
|
|
|
return "Hello"
|
|
|
|
|
2020-07-13 14:39:43 +00:00
|
|
|
@route("/static/<filename>")
|
|
|
|
def static_path(filename):
|
2020-09-23 15:34:05 +00:00
|
|
|
template_path = abspath(getcwd()) / Path("tests/mock_server/templates")
|
|
|
|
response = static_file(filename, root=template_path)
|
|
|
|
return response
|
|
|
|
|
|
|
|
@route("/static_no_content_type/<filename>")
|
|
|
|
def static_no_content_type(filename):
|
2020-07-13 14:39:43 +00:00
|
|
|
template_path = abspath(getcwd()) / Path("tests/mock_server/templates")
|
2020-07-22 15:24:08 +00:00
|
|
|
response = static_file(filename, root=template_path)
|
|
|
|
response.set_header("Content-Type", "")
|
|
|
|
return response
|
2020-07-13 14:39:43 +00:00
|
|
|
|
2020-07-07 19:46:45 +00:00
|
|
|
def start():
|
|
|
|
run(host='localhost', port=8080)
|