Иван Солнцев
a4f7411e10
- Move log initialization to config file; - Add meta tag for charset to index file.
27 lines
734 B
Python
27 lines
734 B
Python
import logging
|
|
|
|
from server.urlhandler import path
|
|
import testmod
|
|
|
|
SETUP = {
|
|
"setup": {
|
|
"log_to_file": False,
|
|
"log_level": logging.DEBUG
|
|
},
|
|
"server": {
|
|
"port": 8080,
|
|
}
|
|
}
|
|
|
|
if SETUP["setup"]["log_to_file"]:
|
|
logging.basicConfig(filename="main.log", filemode="a", encoding="UTF-8",
|
|
level=SETUP["setup"]["log_level"],
|
|
format="[%(name)s][%(asctime)s][%(levelname)s] %(message)s")
|
|
else:
|
|
logging.basicConfig(encoding="UTF-8", level=SETUP["setup"]["log_level"],
|
|
format="[%(name)s][%(asctime)s][%(levelname)s] %(message)s")
|
|
|
|
urls = [
|
|
path("/", "static-file", "index.html"),
|
|
path("/func", "function", testmod.work)
|
|
]
|