socketify.py icon indicating copy to clipboard operation
socketify.py copied to clipboard

App.static will be hang up by reload some times

Open shaohaiyang opened this issue 7 months ago • 1 comments

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

shaohaiyang avatar Jan 18 '24 14:01 shaohaiyang