Re: Run Python Code on Front-End

2023-05-22 Thread Mike Dewhirst

On 23/05/2023 10:22 am, Muhammad Juwaini Abdul Rahman wrote:
How can one run Python code from the backend that triggers on the 
front-end upon clicking a button on a certain page?




Have a close look at htmx.

It doesn't run Python but will replace any targeted HTML element with 
output from Python (or any other code) running on the backend.


You would otherwise need a Python interpreter running in the browser. 
But who wants that with all the security issues entailed?


Htmx is a javascript library which enhances HTML itself. Your HTML in 
your template then calls your Django views directly to replace any part 
of a page with the result.


If htmx had been around earlier, all those famous js frameworks would 
never have been needed. It is a life saver.


M

--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Your
email software can handle signing.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0fefeee4-530f-6097-ad2b-594dfbf1dd9d%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Re: Run Python Code on Front-End

2023-05-22 Thread Muhammad Juwaini Abdul Rahman
You might want to try pyscript for this.

Natively, there's no way you can run python on browser.

On Tue, 23 May 2023 at 07:52, Lightning Bit <
thelegendofearthretu...@gmail.com> wrote:

> Hello all,
>
> I've created an accessibility app where the *speech_recognition* package
> is utilized and triggered upon running a Python function. I can
> successfully run the Python code in Jupyter Lab - no problems. However, it
> seems impossible to activate the *speech_recognition* package on the
> front-end from my views in the Django application.
>
> How can one run Python code from the backend that triggers on the
> front-end upon clicking a button on a certain page?
>
> Thanks all
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ca5edbef-3244-4d67-ad32-3cd9741c8ccdn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFKhtoTry3Zo06Xpvqssgh9mdCUv_VD2yP%2B_B7ZtqruoTkFf7Q%40mail.gmail.com.


Run Python Code on Front-End

2023-05-22 Thread Lightning Bit
Hello all, 

I've created an accessibility app where the *speech_recognition* package is 
utilized and triggered upon running a Python function. I can successfully 
run the Python code in Jupyter Lab - no problems. However, it seems 
impossible to activate the *speech_recognition* package on the front-end 
from my views in the Django application. 

How can one run Python code from the backend that triggers on the front-end 
upon clicking a button on a certain page? 

Thanks all

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ca5edbef-3244-4d67-ad32-3cd9741c8ccdn%40googlegroups.com.