Last active
December 21, 2022 14:21
-
-
Save tconkling/1e5ead87c796a82de7fa71fcc4a74777 to your computer and use it in GitHub Desktop.
Serve static files from your Streamlit app
This file contains 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
""" | |
Edit `streamlit/lib/Server.py`, and add "static_path" to `TORNADO_SETTINGS`. | |
You'll also need to import the `os` package. | |
See https://www.tornadoweb.org/en/branch5.1/guide/running.html#static-files-and-aggressive-file-caching | |
for more details. | |
""" | |
import os | |
TORNADO_SETTINGS = { | |
"compress_response": True, # Gzip HTTP responses. | |
"websocket_ping_interval": 20, # Ping every 20s to keep WS alive. | |
"websocket_ping_timeout": 30, # Pings should be responded to within 30s. | |
"websocket_max_message_size": MESSAGE_SIZE_LIMIT, # Up the WS size limit. | |
# Serve static files from <cwd>/static. To expose "myfile.txt" to the user | |
# for downloading, write it to static/myfile.txt, and then link to | |
# https://<yourserver>:8501/static/myfile.txt. (Or whatever port your | |
# streamlit server is running on.) | |
"static_path": os.path.join(os.getcwd(), "static"), | |
} |
wonderful,it works as wish, thanks
i am at windows,the path is ----streamlit\server\Server.py
Once I add this change, it worked for a while and then streamlit app goes blank. Not sure whats exactly happening !!!
also this problem i met
@nhchyy This hack is not dependable. It works on and off. Refer to this [link] (streamlit/streamlit#400 (comment))
plz help me how to install streamlit
This is great, thanks for sharing
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Once I add this change, it worked for a while and then streamlit app goes blank. Not sure whats exactly happening !!!