Adding a “code checker” for my e-learning wordpress site

This is not really a WP question, and would be better suited for StackOverflow, but I’ll let you know my answer anyhow.

Since your Python should be running completely independent of your WordPress site, it might be best to make an API for your Python application. Then, you can use PHP in your WordPress application to cURL your Python application and process the returned data.

I had second thoughts about leaving this part in my answer:


If you plan to make the Python run on the same VM as your wordpress install, you could use shell_exec to run your python and get the output. However, I highly recommend avoiding this because it is extremely risky in most cases. If this is required, it is best to make sure that absolutely no user-generated info is passed through the shell_exec command (it’s best to make the Python get the user generated info from a separate file or from memory so there is no chance it can be executed).

Since your question is very general, that is about all I can say without speculating.