Forums

Running a user-defined Python script securely on a server

Hello,

I'm exploring solutions for creating a service that runs Python code (possibly added with some libraries like NumPy) that the user wrote, kind of like an online IDE service. Anything that comes from the user is very dangerous to run, so I was wondering if PythonAnywhere is the right place to look for this solution. What's the best, most secure way to do this in PythonAnywhere?

If I understand correctly you'd like to build something like PythonAnywhere inside of PythonAnywhere? Basically we don't have features for that -- everything that is run via your account on PythonAnywhere is run on your account. If you'd like to have, say, a web app that allows users to execute an arbitrary Python code, that would run on your account and would have all the restrictions your account have; you'd need to implement all the security details that would protect your account and prevent users from destroying your very web app.