app.py 804 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. # @Author: Bachir Soussi Chiadmi <bach>
  4. # @Date: 23-05-2017
  5. # @Email: bachir@figureslibres.io
  6. # @Last modified by: bach
  7. # @Last modified time: 21-04-2017
  8. # @License: GPL-V3
  9. import sys
  10. from socket import socket
  11. import socketserver
  12. import http.server
  13. # from PyQt5.QtWebKit import QWebView
  14. # from PyQt5.QtGui import QApplication
  15. # from PyQt5.QtCore import QUrl
  16. # web werver
  17. sock = socket()
  18. sock.bind(('', 0))
  19. PORT = sock.getsockname()[1]
  20. print(PORT)
  21. sock.close()
  22. # PORT = 8000
  23. Handler = http.server.SimpleHTTPRequestHandler
  24. httpd = socketserver.TCPServer(("", PORT), Handler)
  25. print("serving at port", PORT)
  26. httpd.serve_forever()
  27. # QT webkit
  28. # app = QApplication(sys.argv)
  29. # browser = QWebView()
  30. # browser.load(index.html)
  31. # browser.show()
  32. # app.exec_()