Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flex component along with django template #677

Open
keinagae opened this issue Nov 22, 2020 · 6 comments
Open

flex component along with django template #677

keinagae opened this issue Nov 22, 2020 · 6 comments

Comments

@keinagae
Copy link

I found flex to be very interesting project and I was looking for a way to make it integrate able with django but not as separate server like this where we can proxy flask request to flex.
but what I am looking at is not proxying but more like making it possible to hook flex component in django rendered template and instead of using tornado I am thinking to use django channels for server and was think to create a class based on django channels for PyComponents. More like vue components with out spa. so was thinking would it be possible to do that in flex or it will be a complete separate projects?

@keinagae keinagae changed the title looking for proper starting point to make flex integrate able with django flex component along with django template Nov 22, 2020
@almarklein
Copy link
Member

That sounds like it would need quite a few changes in Flexx itself. Perhaps it would be best to try this in a fork first? If it's possible to generalize these changes we could consider implementing (some of them) in Flexx itself. What do you think?

@keinagae
Copy link
Author

yes indeed we should try it in a fork and as for my understanding we will be replacing whole tornado implementation with django channels or with next async django releases and then as for widgets i think we will have to reimplement PyComponent

and can you suggest me good starting point to work on this?

@keinagae
Copy link
Author

and also with pyscript is it possible to render from server for first time?

@almarklein
Copy link
Member

If you want to integrate PyWidgets with another class, have a look at app/_component2.py. That code is quite complex. You could also consider wrapping instead of subclassing.

For replacing Tornado, have a look at this base class and this Tornado implementation.

and also with pyscript is it possible to render from server for first time?

You mean to precompile Python code to JS? Sure! See e.g. https://pscript.readthedocs.io/en/latest/api.html#pscript.py2js. You'd have to use the inspect module to get the source lines.

@keinagae
Copy link
Author

keinagae commented Dec 2, 2020

no not generating js code but actual html as it will be help full for crawlers and search engines

@almarklein
Copy link
Member

pscript is used to generate JS from Python code. No HTML there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants