# -*- coding: utf-8 -*- # Static file server for the trip page, for a Pelican/Pterodactyl Python egg. # Works on Python 2.7 and every Python 3 version. # Put index.html in the same folder as this file and start the server. # The port is read from SERVER_PORT, which the panel sets for every server. import os import sys PORT = int(os.environ.get("SERVER_PORT", "8080")) ROOT = os.path.dirname(os.path.abspath(__file__)) os.chdir(ROOT) try: from http.server import HTTPServer, SimpleHTTPRequestHandler from socketserver import ThreadingMixIn except ImportError: # Python 2 from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler from SocketServer import ThreadingMixIn class Server(ThreadingMixIn, HTTPServer): daemon_threads = True allow_reuse_address = True httpd = Server(("0.0.0.0", PORT), SimpleHTTPRequestHandler) print("Az oldal fut: port %d" % PORT) sys.stdout.flush() httpd.serve_forever()