Try different ports for web interface

master
Tanner Collin 3 years ago
parent 15d4dd7922
commit 3c31c41acd
  1. 18
      main.py

@ -91,14 +91,22 @@ def main():
observer.stop()
observer.join()
if __name__ == '__main__':
def run_api():
host = '0.0.0.0'
port = 3300
threading.Thread(target=app.run, kwargs={'host': host, 'port': port}).start()
print('Web interface listening on port:', port)
print('Try going to http://localhost:' + str(port))
while True:
print('Trying to run web interface on port:', port)
print('If it works, go to http://localhost:' + str(port))
try:
app.run(host=host, port=port)
except OSError:
print()
print('Error: Port already taken.')
port += 1
if __name__ == '__main__':
threading.Thread(target=run_api).start()
time.sleep(1)
main()

Loading…
Cancel
Save