-
-
Notifications
You must be signed in to change notification settings - Fork 97
Description
(Possibly could be connected with #1303)
Another nice thing would be to allow people to play around with components in some kind of playground - AKA a place where people could define the JS/CSS/HTML of a component, and they would see the result of it right in the the browser.
Options
1. Browser-only code with Pyodide
The best would have been if the code could be ran in JS in WebAssembly. There is pyodide, which would allow us to execute Python code in the browser. Pyodide can also install 3rd party packages from PyPI.
However, that might not be yet possible, because django-components currently depends on django, and django relies of file structure to import / find things.
So this approach may be blocked until django-components can be ran independently of django.
Theoretically we could try if django-components would work with projects like uDjango or mini-django.
2. Serverless function for rendering Python components
For a nice and integrated approach, and if we also had a serverless function for AI generation of components (#1303), we could make another function that would simply render the component and return the result.
Unlike the first approach, in this case the component rendering would run within Python/Django, so this is not blocked by anything.
3. Quick CodeSandbox template
Instead of running serverless functions, we could simply prepare a codebase template that people could fork and run on services like CodeSandbox to play and experiment there.
E.g. see https://codesandbox.io/p/sandbox/github/codesandbox/sandbox-templates/tree/main/python