AdityaAdaki commited on
Commit
e4d31bb
·
1 Parent(s): 7bda8d1

css update

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from flask import Flask, render_template, request, jsonify, send_from_directory
2
  import os
3
  import tempfile
4
  import atexit
@@ -14,7 +14,7 @@ import mutagen.flac
14
  import mutagen.oggvorbis
15
  from werkzeug.utils import secure_filename
16
 
17
- app = Flask(__name__, static_folder='static')
18
  # Create a temporary directory for uploads
19
  TEMP_UPLOAD_DIR = tempfile.mkdtemp()
20
  app.config['UPLOAD_FOLDER'] = TEMP_UPLOAD_DIR
@@ -112,7 +112,8 @@ def favicon():
112
 
113
  @app.route('/')
114
  def index():
115
- return render_template('index.html', title="Soundscape - 3D Music Visualizer")
 
116
 
117
  def cleanup_old_files():
118
  while True:
@@ -224,5 +225,14 @@ def cleanup():
224
 
225
  atexit.register(cleanup)
226
 
 
 
 
 
 
 
 
 
 
227
  if __name__ == '__main__':
228
  app.run(host='0.0.0.0', port=7860)
 
1
+ from flask import Flask, render_template, request, jsonify, send_from_directory, url_for
2
  import os
3
  import tempfile
4
  import atexit
 
14
  import mutagen.oggvorbis
15
  from werkzeug.utils import secure_filename
16
 
17
+ app = Flask(__name__)
18
  # Create a temporary directory for uploads
19
  TEMP_UPLOAD_DIR = tempfile.mkdtemp()
20
  app.config['UPLOAD_FOLDER'] = TEMP_UPLOAD_DIR
 
112
 
113
  @app.route('/')
114
  def index():
115
+ return render_template('index.html',
116
+ static_url_path=url_for('static', filename=''))
117
 
118
  def cleanup_old_files():
119
  while True:
 
225
 
226
  atexit.register(cleanup)
227
 
228
+ # Create static folder if it doesn't exist
229
+ os.makedirs('static/js', exist_ok=True)
230
+ os.makedirs('static/css', exist_ok=True)
231
+
232
+ # Add a route to serve static files
233
+ @app.route('/static/<path:filename>')
234
+ def serve_static(filename):
235
+ return send_from_directory('static', filename)
236
+
237
  if __name__ == '__main__':
238
  app.run(host='0.0.0.0', port=7860)