Last active
September 10, 2022 20:07
-
-
Save Lebski/e637d4d47887fb25843ae5042ae65c42 to your computer and use it in GitHub Desktop.
Flask basic file server - lets you serve your folder and nothing more
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, send_from_directory | |
app = Flask(__name__, static_url_path='', static_folder='files') | |
@app.route("/") | |
def index(): | |
return send_from_directory("files", 'index.html') | |
if __name__ == "__main__": | |
app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A basic file server if you want to host a static website with a webserver in 10 lines of code
My folder name was
"files"
but feel free to change it to anything else in line 3 and 7.Also the name of your index page.