mirror of
https://github.com/kennethreitz/replit-py.git
synced 2026-06-05 23:10:18 +00:00
Add files example
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
from replit import maqpy
|
||||
|
||||
app = maqpy.App(__name__)
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
# Once a file is loaded once, it is cached in memory unless you pass the no_cache
|
||||
# kwarg to the File constructor
|
||||
f = maqpy.File(__file__)
|
||||
# Tell the browser its just text, not a webpage
|
||||
# we can edit the headers directly because the file is just a flask.Response object
|
||||
f.headers["Content-Type"] = "text/plain"
|
||||
return f
|
||||
Reference in New Issue
Block a user