-
I am an experienced Python developer, and I'd like to create a website with PWA support. How feasible is this with JustPy (particularly re creating service workers)? I am wondering if I may need to use something like Brython workers to bridge the gap. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
A main feature of PWAs is that they can work with no or a slow internet connection. JustPy applications cannot since in JustPy there is no frontend/backend distinction. You take care of events in the frontend in the backend basically. A python in the browser solution like Brython may be a better way to go. If your main concern is long running background tasks and can assume good internet connection, you can use JustPy effectively by running those tasks as part of your application. Please take a look at this example: https://justpy.io/tutorial/pushing_data/#clock You can initiate your background tasks in the init function and then have them run in the same async loop as the application. Or you can use the say, the multiprocessing module to run them and interact with them using a function you initiate in the init function. If this is not clear, please let me know. |
Beta Was this translation helpful? Give feedback.
A main feature of PWAs is that they can work with no or a slow internet connection. JustPy applications cannot since in JustPy there is no frontend/backend distinction. You take care of events in the frontend in the backend basically. A python in the browser solution like Brython may be a better way to go.
If your main concern is long running background tasks and can assume good internet connection, you can use JustPy effectively by running those tasks as part of your application. Please take a look at this example: https://justpy.io/tutorial/pushing_data/#clock
clock_counter
is a background task in this exampleYou can initiate your background tasks in the init function and then have the…