diff --git a/master/main.py b/master/main.py index 45ffc35..e6c0ae2 100644 --- a/master/main.py +++ b/master/main.py @@ -390,6 +390,61 @@ def workerIP(worker): return ip +# Home page +@app.route('/') +def home(): + # Show stats and info + + # Get worker info + workers = [] + try: + workers_file = open('/data/workers.txt', 'r') + workers = workers_file.readlines() + workers_file.close() + except FileNotFoundError: + pass + + # Get site info + sites = [] + try: + sites_file = open('/data/sites.txt', 'r') + sites = sites_file.readlines() + sites_file.close() + except FileNotFoundError: + pass + + # Get licence info + licences = [] + try: + licences_file = open('/data/licence_key.txt', 'r') + licences = licences_file.readlines() + licences_file.close() + except FileNotFoundError: + pass + + # Create html page + html = "
Number of workers: " + str(len(workers)) + "
" + html += "Workers:
" + html += "Number of sites: " + str(len(sites)) + "
" + html += "Sites:
" + html += "Number of licences: " + str(len(licences)) + "
" + + + + + # Start the server if __name__ == '__main__': app.run(debug=False, port=5000, host='0.0.0.0') \ No newline at end of file