dongqian9567 2014-11-27 19:20
浏览 32

如何在我的Python Google Apps Engine中使用PHP模块

I'm writing a website using Google Apps Engine Python, and a friend has written some code that he has kindly shared with me that I want to use that's written in PHP. Basically it draws diagrams given some code, and should save an image for it if it doesn't exist.

I've got that code stored in my database in a variable called Diagram_Code, and I want the diagram to render on the page. I'm using jinja to do my templating. I expect I'll have two directories somehow, one with the code in it, and another one with the saved diagrams which are an md5(Diagram_Code).jpg.

I've looked at the documentation for the app.yaml, but I don't understand how I should include it there, if I should.

I'm expecting my python might look something like this:

if not "/diagrams",md5(Diagram_Code),".jpg": #Check if diagram exists already
    FUNCTION_TO_USE_PHP(Diagram_Code) #Make diagram with some function
img_url="/diagrams/",md5(Diagram_Code),".jpg"

How should I include it in my app.yaml, and how do I call it in my Python code if this is possible? and if not, what might be the best solution to be able to use what is in the PHP?

  • 写回答

1条回答 默认 最新

  • douhuan1937 2014-11-27 20:47
    关注

    You need to use the modules feature, more documentation can be found here.

    Basically you deploy a PHP module along side your Python application. You use URLFetch from your python code to make a request to the PHP module to render out whatever it is that you want.

    See this on how to do the communication between modules.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题