最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

server - Adding a "code checker" for my e-learning wordpress site

programmeradmin0浏览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

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

Share Improve this question asked Jul 9, 2019 at 19:13 Florian ClusterFlorian Cluster 1
Add a comment  | 

1 Answer 1

Reset to default 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.

发布评论

评论列表(0)

  1. 暂无评论