diff --git a/app.db b/app.db new file mode 100644 index 0000000..06cb959 Binary files /dev/null and b/app.db differ diff --git a/index.py b/index.py index 3d486e3..c59c197 100644 --- a/index.py +++ b/index.py @@ -42,14 +42,30 @@ def calculate_ram_percent(stats, status): load_dotenv() -scheduler = APScheduler() +basedir = os.path.abspath(os.path.dirname(__file__)) app = Flask(__name__) +#SESSION app.secret_key = "sdasdsadasdasdasdadadaasd53563da" app.permanent_session_lifetime = timedelta(days=1) + +#DATABASE +app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///'+ os.path.join(basedir, 'app.db') +app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False + +db = SQLAlchemy(app) + +class users(db.Model): + _id = db.Column(db.Integer, primary_key=True) + name = db.Column(db.String(255)) + password = db.Column(db.String(255)) + + def __init__(self, name, password): + self.name = name + self.password = password + + +scheduler = APScheduler() client = docker.from_env() - - -# db = SQLAlchemy(app) # migrate = Migrate(app, db) # login_manager.init_app(app) @@ -133,4 +149,6 @@ def scheduleTasks(): if __name__ == '__main__': # scheduler.add_job(id = 'scheduled_tasks', func=scheduleTasks, trigger="interval", seconds=60) # scheduler.start() + app.app_context().push() + db.create_all() app.run(host=os.getenv('IP'), port=os.getenv('port'), debug=True) diff --git a/templates/index.html b/templates/index.html index 23dd15c..31aab5c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -28,7 +28,6 @@
-
@@ -80,7 +79,6 @@ route = (status == 'running' ? 'stop' : 'start') method = (status == 'running' ? 'DELETE' : 'POST') - const xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () {