How to embed a Python interpreter on a website

前端 未结 4 905
夕颜
夕颜 2020-12-24 00:23

I am attempting to build an educational coding site, similar to Codecademy, but I am frankly at a loss as to what steps should be taken. Could I be pointed in the right dire

4条回答
  •  一整个雨季
    2020-12-24 01:14

    There's more to do here than you think.

    The major problem is that you cannot let people run arbitrary Python code on your webserver. For example, what happens if they do

    import os
    os.system("rm -rf *.*")
    

    So clearly you have to run this Python code securely. But then you have the problem of securing Python, which is basically impossible because of how dynamic it is. And so you'll probably have to run the Python shell in a virtual machine, which comes with its own headaches.


    Have you seen e.g. http://code.google.com/p/google-app-engine-samples/downloads/detail?name=shell_20091112.tar.gz&can=2&q=?

提交回复
热议问题