1

I am making a website with Django.

I created a python file and I'd like to run that file on my website. How to do that?

import requests
import pygame,sys

pygame.init()

//code 

pygame.display.update()
surftijmen
  • 743
  • 1
  • 10
  • 27
  • @Stevy given the script that he wants to execute, I wouldn't consider this a duplicate. Also, the question you linked is a terrible question... – Lord Elrond May 28 '19 at 22:15
  • You are right. I did not realise it was a pygame file. Thanks for the heads up. – Stevy May 28 '19 at 22:53
  • can someone please answer my question – surftijmen May 29 '19 at 10:08
  • 2
    Your browser cannot run python, so basically you cannot run a pygame inside the browser. You would need a javascript wrapper that sends events (user input) to your back-end in a format that needs to be translated to pygame events, and in return receives the screen updates live (via a web socket). I don't know if such wrapper exists but in general, running games over the network is not an easy task (due to latency). So to put it simply: the answer is it's not possible. – dirkgroten May 29 '19 at 10:24

0 Answers0