SQL Connection DOne
This commit is contained in:
		
							
								
								
									
										26
									
								
								index.py
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								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)
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,6 @@
 | 
			
		||||
          <div class="square-content" onclick="openModalForContainer('{{container.id}}')">
 | 
			
		||||
            <!-- Content for the square item -->
 | 
			
		||||
            <div class="d-flex justify-content-between">
 | 
			
		||||
 | 
			
		||||
              <img height="60" width="60"
 | 
			
		||||
                src="https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/nginx.svg" alt="">
 | 
			
		||||
              <div class="form-check form-switch form-check-reverse">
 | 
			
		||||
@@ -80,7 +79,6 @@
 | 
			
		||||
      route = (status == 'running' ? 'stop' : 'start')
 | 
			
		||||
      method = (status == 'running' ? 'DELETE' : 'POST')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      const xhttp = new XMLHttpRequest();
 | 
			
		||||
 | 
			
		||||
      xhttp.onreadystatechange = function () {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user