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()
4
  • @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... Commented May 28, 2019 at 22:15
  • You are right. I did not realise it was a pygame file. Thanks for the heads up. Commented May 28, 2019 at 22:53
  • can someone please answer my question Commented May 29, 2019 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. Commented May 29, 2019 at 10:24

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.