socketify.py
socketify.py copied to clipboard
App.static will be hang up by reload some times
Describe the bug
When i specify the static directory with static param,refresh the index.html with some static resource such as js and css, the page will be hang up by reload multi-times except first time is normal.
BTW:
When I comment this line to lost javascript and css style :
#app.static("/static", "./static")
but it is normal no matter how many times I refresh.
main.py
app = App()
app.template(Jinja2Template("./templates", encoding="utf-8", followlinks=False))
app.json_serializer(ujson)
app.static("/static", "./static")
router = app.router()
@app.get("/")
async def head(res, req):
if not db.is_connected(): db.connect()
try:
posts = db.post.find_many(take=10, order={"id":'desc'}, include={"author": True} )
context = {
"framework": "Robyn",
"templating_engine": "Jinja2",
"data": posts
}
if DEBUG: print(context)
res.render("index.html", **context)
except Exception as e:
pass
Desktop (please complete the following information):
- pypy:3.9-7.3.11-slim-bookworm