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.stop()
|
||||||
observer.join()
|
observer.join()
|
||||||
|
|
||||||
|
def run_api():
|
||||||
if __name__ == '__main__':
|
|
||||||
host = '0.0.0.0'
|
host = '0.0.0.0'
|
||||||
port = 3300
|
port = 3300
|
||||||
|
|
||||||
threading.Thread(target=app.run, kwargs={'host': host, 'port': port}).start()
|
while True:
|
||||||
print('Web interface listening on port:', port)
|
print('Trying to run web interface on port:', port)
|
||||||
print('Try going to http://localhost:' + str(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)
|
time.sleep(1)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user