Pārlūkot izejas kodu

Cleaned up the starting process for the application.

Adam Day 2 gadi atpakaļ
vecāks
revīzija
b5ad6aebbc
6 mainītis faili ar 52 papildinājumiem un 5 dzēšanām
  1. 3 0
      .gitignore
  2. 1 1
      LICENSE
  3. 18 1
      README.md
  4. 27 3
      app.py
  5. BIN
      requirements.txt
  6. 3 0
      settings.ini

+ 3 - 0
.gitignore

@@ -1,2 +1,5 @@
 /site.db
 .idea
+/app.spec
+/build/
+/dist/

+ 1 - 1
LICENSE

@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) <year> <copyright holders>
+Copyright (c) 2022 Twin Falls Public Library
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 

+ 18 - 1
README.md

@@ -1,2 +1,19 @@
-# ils-password-management
+# ILS Password Management Tool 
+
+This tool is a self-contained web application that allows users to manage their ILS password reset notifications. It is designed to be used by the Lynx Library staff. It is not designed to be used by the general public.
+
+## Usage
+Start the application on any Windows system connected to the network.
+
+
+## Initial Setup
+- Start the application
+- In a web browser navigation to the admin panel: `http://<system name or IP>>:<port>>/admin`
+- Admin username and password is 'admin' and 'admin'
+- Reset the default admin password.
+- Create new user accounts for the staff.
+- Close the application
+
+## License
+This tool is licensed under the MIT license. See the LICENSE file for more information.
 

+ 27 - 3
app.py

@@ -4,12 +4,22 @@ from flask import Flask, render_template, request, redirect, url_for
 import configparser
 from gevent.pywsgi import WSGIServer
 import socket
+import logging
 
 config = configparser.ConfigParser()
 config.read('settings.ini')
+application_settings = config['application']
 smtp_settings = config['smtp']
 http_settings = config['http']
 
+log = logging.getLogger('werkzeug')
+log.setLevel(logging.INFO)
+
+if application_settings['debug'].lower() == 'true':
+    debug = True
+else:
+    debug = False
+
 
 def send_email(to, subject, body):
     # Get settings from smtp_settings
@@ -53,8 +63,22 @@ def get_ip_address():
 
 
 if __name__ == "__main__":
+    print("------------------------- Start up -----------------------------")
     print("Starting HTTP Service on port %s..." % http_settings['port'])
-    http_server = WSGIServer(('0.0.0.0', int(http_settings['port'])), app)
-    print("HTTP Service Started!")
-    print("Access the Dashboard on http://%s:%s" % (get_hostname(), http_settings['port']))
+
+    if debug is True:
+        print("Debug mode is enabled.")
+        http_server = WSGIServer(('0.0.0.0', int(http_settings['port'])), app)
+    else:
+        http_server = WSGIServer(('0.0.0.0', int(http_settings['port'])), app, log=log, error_log=log)
+    print("HTTP Service Started.")
+    print("--------------------- Application Details ---------------------")
+    print("Application started at %s" % datetime.datetime.now())
+    print("System IP Address: %s" % get_ip_address())
+    print("System Hostname: %s" % get_hostname())
+    print("Access the Dashboard using a web browser using any of the following:")
+    print("http://%s:%s or http://%s:%s" % (get_hostname(), http_settings['port'], get_ip_address(), http_settings['port']))
+    print("---------------------------------------------------------------")
+    print("To stop the application close this window.")
+    print("---------------------------------------------------------------")
     http_server.serve_forever()

BIN
requirements.txt


+ 3 - 0
settings.ini

@@ -1,3 +1,6 @@
+[application]
+debug = true
+
 [http]
 port = 5055