ServerX commited on
Commit
a812d11
·
verified ·
1 Parent(s): cbaf587

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -1,11 +1,21 @@
 
 
1
  from flask import Flask, send_file
2
  import os
3
 
 
 
 
 
 
 
 
 
4
  app = Flask(__name__)
5
 
6
  @app.route('/')
7
  def home():
8
- # Servire direttamente il file index.html dalla stessa cartella
9
  return send_file(os.path.join(os.getcwd(), 'index.html'))
10
 
11
  if __name__ == '__main__':
 
1
+ import subprocess
2
+ import sys
3
  from flask import Flask, send_file
4
  import os
5
 
6
+ # Funzione per installare le dipendenze dal file requirements.txt
7
+ def install_requirements():
8
+ subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-r', 'requirements.txt'])
9
+
10
+ # Verifica se i pacchetti necessari sono installati e, in caso contrario, li installa
11
+ install_requirements()
12
+
13
+ # Crea l'app Flask
14
  app = Flask(__name__)
15
 
16
  @app.route('/')
17
  def home():
18
+ print("Request received, serving index.html")
19
  return send_file(os.path.join(os.getcwd(), 'index.html'))
20
 
21
  if __name__ == '__main__':