P
P
Pride1252020-04-22 10:00:54
Python
Pride125, 2020-04-22 10:00:54

How to create a website so that you can program in python in it?

I want to write a website where you can write code in Python, as well as run it and get the correct result. It can be said that I am a delegate in this matter, but there is a lot of time and a desire to understand this issue. If anyone has experience in similar or knows how to implement this, I will only be glad to hear your ideas.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Pankov, 2020-04-22
@trapwalker

Use ready .
And to make your own is a very non-trivial task. The main problem is isolation and compatibility.
On the one hand, you need to block all opportunities to get out of the "sandbox" and harm the machine in which the interpreter is running or prevent attempts to send spam and porn from your servers uncontrolled.
On the other hand, after blocking everything dangerous, you need to keep the ability to run harmless programs so that they do not have to be finished to fit your sandboxed python.
Both tasks are not trivial, you need to delve into the peculiarities of the internal kitchen of the interpreter, into the details of the standard library and the features of the operating system.
1. Google "python sandbox".
2. Specify the task. What code do you want to run, do you want to include third-party libraries, but binary libraries?

T
Timur Pokrovsky, 2020-04-22
@Makaroshka007

read about eval()
https://pythonz.net/references/named/eval/

S
Sergey Sokolov, 2020-04-22
@sergiks

Raise a docker container from Jupyter Notebook: jupyter/docker-stacks

screen
jupyterpreview.png

The same, even a little better, already online from Google: colab.research.google.com

K
kamenyuga, 2020-04-22
@kamenyuga

A good example of such an idea is https://py3.codeskulptor.org/. The project was created based on https://skulpt.org/.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question