Search code examples
javascriptpythonhtmldjangopyscript

Pyscript in Django application


I am wondering if we could use pyscript on HTML pages inside a Django project.

I'd tried to use it but unfortunately, it doesn't work.

this is the code :

<head>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
</head>


<body>
    <div class="row">
        <div class="col-md-12" >
            <center><h3><py-script> print('Now you can!') </py-script></h3></center>
        </div>
    </div>
</body>
</html>

I was using Django==2.2.28 then I upgraded it to the last version Django==4.0.4 both didn't work and I get a black page!.

Any suggestions?


Solution

  • I get the solution.

    I was using IDM that was catch any download in the browser. So I deleted the file extension from IDM (.TAR) so my browser was able to download and use the pyodide_py.tar file.

    (you should wait for a little python is slow :) )

    Many thanks