0

I am currently developing an e-learning platform with wordpress (using learndash) to teach python and I would like my students to be able to submit their python script on the website and get a mark depending on how well they succeeded the exercise.

I already made a program (in python as well) that take a script and gives a mark, now I must find a way to connect this program I have on my machine localy to wordpress.

I guess I have to run my marking program on a server and make it wait for an input, but how can I make a wordpress page send a file to this program on that server and grab the result and display it back on the page ?

I hope I am clear enough and please forgive me for my approximative english ! Let me know if you need any further information to understand my question.

Thanks a lot, Florian

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.