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.
 
 

26 lines
614 B

  1. # -*- coding: UTF-8 -*-
  2. #!/usr/bin/env pyton3
  3. from http.server import HTTPServer
  4. from src.handler import Handler as Handler
  5. import os, sys, json
  6. #PORT_NUMBER = 8000
  7. from findfsdb import create_db
  8. from utils.utils import load_config
  9. def run():
  10. create_db()
  11. config = load_config()
  12. if len(config) ==0:
  13. print("конфиг пустой")
  14. try:
  15. print(config['PORT'])
  16. except KeyError:
  17. print("KeyError")
  18. except KeyboardInterrupt:
  19. pass
  20. server = HTTPServer(('', config['PORT']), Handler)
  21. print ('Started HTTP Server on port ' , config['PORT'])
  22. server.serve_forever()
  23. if __name__ == '__main__':
  24. run()