Add uvicorn reload configuration parameter to Justpy
Uvicorn has the ability to automatically restart the server when a file changes.
I currently use this functionality by starting the uvicorn server as follows (while adding the argument start_server=False to the justpy command):
uvicorn.run("main:app", host="127.0.0.1", port=8080, log_level="warning", reload=True)
Is it possible to add this option to the justpy command itself (and configuration variables)?
I'll add this feature in one of the next versions.
When I run using uvicorn as stated in my previous post, JustPy still outputs JustPy ready to go on http://{HOST}:{PORT}, despite start_server=False.
So I believe this line in the justpy_startup function should actually only be executed when start_server=True:
print(f'JustPy ready to go on http://{HOST}:{PORT}')
Yes, I agree. However that is printed as the last statement of the startup and that function does not have access to start_server. Since users that run uvicorn from the command line are advanced users, I don't think this will throw them off. In any case I will check if there is a simple solution.
I this going to be in 0.3.0?
If you have this need you might want to migrate to nicegui