Try different ports for web interface
This commit is contained in:
parent
15d4dd7922
commit
3c31c41acd
18
main.py
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…
Reference in New Issue
Block a user