-1

is it possible to run Python code in the background of my web/html pages, directly on internet?

Suppose I made a code with shuffle words (mix words), and I want to make an html page that have that python code in the background, to run that page as an application. Everytime someone will access that page, Python code will do the work.

Is it possible?

Just Me
  • 864
  • 2
  • 18
  • 28
  • 1
    you mean like a "python implementation in js for the browser"? like [this](https://stackoverflow.com/a/71152153/4935162)? or a server that runs python code and returns it to the client's browser? – Yarin_007 Mar 02 '23 at 10:23
  • Both version , but I believe the easier will be better... You are briliant. Yes, Python. Client Side from https://skulpt.org/ is a good solution of my request – Just Me Mar 02 '23 at 11:40

1 Answers1

0

Open the index.html and add the line inside the tag:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Greetings!</title>
   <link rel="stylesheet" href="https://pyscript.net/releases/2022.12.1/pyscript.css" />
   <script defer src="https://pyscript.net/releases/2022.12.1/pyscript.js"></script>
  </head>
  <body>
   add the following line
  <py-script src="./main.py"></py-script>
  </body>
</html>

Source HERE:

Other Resources:

How to run python code directly on a webpage

How to run a Python script in a web page

https://dev.to/codemaker2015/how-to-run-python-code-in-your-browser-3i7e

https://www.youtube.com/watch?v=du8vQC44PC4&ab_channel=PatrickLoeber

https://www.youtube.com/watch?v=EZL-jobhKfo&ab_channel=KrishNaik

https://www.youtube.com/watch?v=BNM0752XPzw&ab_channel=CodeCove

Just Me
  • 864
  • 2
  • 18
  • 28