PythonMindset commited on
Commit
ae19b5f
·
1 Parent(s): 658d659

Disable caching completely to fix scroll bug on mobile

Browse files
Files changed (2) hide show
  1. app.py +12 -4
  2. index.html +3 -3
app.py CHANGED
@@ -5,16 +5,24 @@ app = Flask(__name__,
5
  static_folder='static',
6
  template_folder='.')
7
 
8
- # Configuration optimisée pour production
9
- app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 31536000
10
 
11
  @app.route('/')
12
  def index():
13
- return send_from_directory('.', 'index.html')
 
 
 
 
 
 
14
 
15
  @app.route('/static/<path:path>')
16
  def serve_static(path):
17
- return send_from_directory('static', path)
 
 
18
 
19
  if __name__ == '__main__':
20
  port = int(os.environ.get('PORT', 7860))
 
5
  static_folder='static',
6
  template_folder='.')
7
 
8
+ # DÉSACTIVER le cache pour les fichiers statiques
9
+ app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
10
 
11
  @app.route('/')
12
  def index():
13
+ response = send_from_directory('.', 'index.html')
14
+ response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'
15
+ return response
16
+
17
+ @app.route('/test')
18
+ def test():
19
+ return send_from_directory('.', 'test.html')
20
 
21
  @app.route('/static/<path:path>')
22
  def serve_static(path):
23
+ response = send_from_directory('static', path)
24
+ response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'
25
+ return response
26
 
27
  if __name__ == '__main__':
28
  port = int(os.environ.get('PORT', 7860))
index.html CHANGED
@@ -12,8 +12,8 @@
12
  <meta charset="UTF-8">
13
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
14
  <title>Portfolio - Cheikh Niang | Data Scientist</title>
15
- <link rel="stylesheet" href="/static/css/style.css">
16
- <link rel="stylesheet" href="/static/css/mobile-performance.css">
17
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&display=swap" rel="stylesheet">
18
  </head>
19
  <body>
@@ -380,6 +380,6 @@
380
 
381
  </main>
382
 
383
- <script src="/static/js/script.js"></script>
384
  </body>
385
  </html>
 
12
  <meta charset="UTF-8">
13
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
14
  <title>Portfolio - Cheikh Niang | Data Scientist</title>
15
+ <link rel="stylesheet" href="/static/css/style.css?v=2">
16
+ <link rel="stylesheet" href="/static/css/mobile-performance.css?v=2">
17
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&display=swap" rel="stylesheet">
18
  </head>
19
  <body>
 
380
 
381
  </main>
382
 
383
+ <script src="/static/js/script.js?v=2"></script>
384
  </body>
385
  </html>