PyScript and Flask: Basic PyScript Frontend and DOM manipulations | PyScript tutorial

Published: 23 May 2022
on channel: Red Eyed Coder Club
7,993
216

This is a very simple project built with PyScript and Flask.
Flask on the backend side, and Pyscript as the frontend.

The main idea of the video is to show how to use only Python both for backend and frontend.

I wanted to show how to make AJAX (asynchronous) GET and POST requests with Pyscript to Flask application, and how to manipulate DOM with Pyscript.

The frontend of the project is written with PyScript. When i'm clicking on the red button ... PyScript sends a GET request to my Flask application and gets a random number from 1 to 10...

When I click on a card... Pyscript sends a POST request to the Flask app and gets the float version of the sent numbers.

And again the video is about how to use Pyscript to send GET and POST requests to Flask, and how use Pyscript to manipulate with DOM

Follow me @:
Telegram: https://t.me/red_eyed_coder_club
Twitter:   / codereyed  
Facebook: https://fb.me/redeyedcoderclub


=== 📎 The source code is available via Patreon ===
  / 68004918  


Timecodes:

00:00 - Description of the Pyscript Flask project, attaching Python module to HTML template.
03:01 - Pyscript basic example.
03:40 - Basic Pyscript on-click event handler and event listener.
06:41 - Creating a basic function to send GET requests from Pyscript to Flask
08:40 - Using of pyfetch to send requests to Flask
10:13 - Creating a Pyscript event handler for a button. Pyscript DOM manipulations.
13:41 - The Flask side: handling requests from Pyscript
16:59 - How to send a POST request with Pyscript to Flask.
24:13 - Result of using Pyscript on Flask frontend.


** Other Flask Tutorials **
Flask AJAX Tutorial: Basic AJAX in Flask app:    • Flask AJAX Tutorial: Basic AJAX in Fl...  
Python Flask and Vue Tutorial:    • Python Flask Vue Tutorial 🔥: TODO app...  
Flask tutorial - blog project:    • Python Flask Tutorial #0: the Demo of...  

Pyscript and Flask: Basic Pyscript Frontend and DOM manipulations | Pyscript tutorial
   • PyScript and Flask: Basic PyScript Fr...  

#pyscript #flask #redeyedcoderclub