|
|
import os |
|
|
from flask import Flask, send_file |
|
|
|
|
|
app = Flask(__name__) |
|
|
|
|
|
@app.route('/') |
|
|
def home(): |
|
|
|
|
|
if os.path.exists('index.html'): |
|
|
return send_file('index.html') |
|
|
else: |
|
|
return "<h1>Error: index.html file nahi mili!</h1><p>Please 'Files' tab mein jakar 'index.html' naam ki file banayein.</p>" |
|
|
|
|
|
@app.route('/<path:filename>') |
|
|
def static_files(filename): |
|
|
if os.path.exists(filename): |
|
|
return send_file(filename) |
|
|
else: |
|
|
return f"File '{filename}' not found", 404 |
|
|
|
|
|
if __name__ == '__main__': |
|
|
app.run(host='0.0.0.0', port=7860) |
|
|
|