在java和python之间传递数据 [英] passing data between java and python
问题描述
我可以知道在Java和Python Django之间传递数据的最佳方法是什么?我听说过Jython,但是根据Django文档,它需要扩展jython-Django,但目前它不支持django 1.2.x.我应该使用stdout传递数据吗?
感谢人们听到我的意见。
使用子流程,并以简单的子流程运行Java程序。这非常非常简单和合理的快速。
如果您需要做更多可扩展的内容,那么您应该考虑创建一个 glassfish 服务器与您的Java代码,所以您的Python可以使Web服务请求到Java。这是更可扩展的,但也更多的工作。
Apologies if my question is noob. I'm running Django 1.2 with pgsql 8.4 and I'm required to run a Java program after getting the inputs from the user, does some calculations and return the results back to the user.
May I know what is the best way to pass data between the Java and Python Django, such that the above scenario are taken care of? I heard of Jython, but according to the Django docs, it requires the extension jython-Django, but currently it doesn't support django 1.2.x. Should I pass the data using stdout?
thanks people for hearing me out.
Use subprocess and run the Java program as a simple subprocess. It's very, very simple and reasonably fast.
If you need to do something more scalable, you should look at creating a glassfish server with your Java code so your Python can make web services requests to the Java. This is more scalable, but also more work.
这篇关于在java和python之间传递数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!