You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# -*- coding: UTF-8 -*-
|
|
|
|
#!/usr/bin/env pyton3
|
|
|
|
from http.server import HTTPServer
|
|
|
|
from src.handler import Handler as Handler
|
|
|
|
import os, sys, json, ssl
|
|
|
|
#PORT_NUMBER = 8000
|
|
|
|
from utils.findfsdb import create_db
|
|
|
|
from utils.utils import load_config
|
|
|
|
def run():
|
|
|
|
create_db()
|
|
|
|
config = load_config()
|
|
|
|
if len(config) ==0:
|
|
|
|
print("конфиг пустой")
|
|
|
|
try:
|
|
|
|
print(config['PORT'])
|
|
|
|
except KeyError:
|
|
|
|
print("KeyError")
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
pass
|
|
|
|
|
|
|
|
server = HTTPServer(('', config['PORT']), Handler)
|
|
|
|
#print ('Started HTTP Server on port ' , config['PORT'])
|
|
|
|
server.socket = ssl.wrap_socket(server.socket,
|
|
|
|
server_side=True,
|
|
|
|
certfile='localhost.pem',
|
|
|
|
ssl_version=ssl.PROTOCOL_TLS)
|
|
|
|
print ('Started HTTP Server on port ' , config['PORT'])
|
|
|
|
server.serve_forever()
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
run()
|