Hello,
You're right that the code is not executed on the server - the server is only used for persistence. Skulpt is a Python->JavaScript transpiler that works as an execution environment on the client. I thought you'd be more interested in comparing your approach to mine, rather than submitting it as a solution to your problem.
The major limitation here is that code execution is not secure against manipulation in terms of verifying local assessment (which has important pedagogical implications for us; we advocate using it as a practice environment, not a summative assessment environment). However, this means that we have a perfectly safe environment in terms of what the user can do to us. It's sandboxed by nature of being in the browser. We do time terminate the code in the client to prevent accidental endless loops, but that's for their benefit rather than our's. If we ever wanted to do secure assessment, our solution would be to simply also send the generated python code to the server to run in a sandbox and verify they got the correct solution; there's already a large space of environments that do this already with many languages, so it's less interesting to us as researchers.
If you use case is to definitely only run on the server, and your goal is to prevent the user from submitting malicious code, then you might want to consider your approach carefully. Remember that the user can submit more than what your interface supports; they are free to use GET/POST requests from within the browser to submit whatever text strings they want. You should never trust user input. You'll probably want to just get a sandboxed Python execution environment, which is a fairly distinct problem from what is done around here. Essentially, code on the server should not be able to do certain things. I suppose you could also only generate Python code on the server according to safe rules, but I would be concerned about edge cases (you'd have a sort of 'Python Injection' problem, like a SQL Injection).
Good luck,
~Cory