跳转到主要内容

一个用于完全使用Python开发客户端-服务器Web应用程序的模块,使用OWL本体进行语义数据持久化,并通过Ajax或WebSocket进行远程过程调用(RPC)。

项目描述

FullPy是一个用于开发客户端-服务器Web应用程序的高级Python模块。以下是主要功能:

  • 客户端和服务器都使用Python编写,并且可以共享代码片段。FullPy使用Brython在Web浏览器中执行Python。

  • 使用OWL本体进行语义感知数据持久化,而不是数据库。FullPy使用Owlready2管理本体,并将它们自动存储在SQLite3数据库中。

  • 客户端和服务器之间的远程函数调用,具有对象序列化。FullPy可以使用Ajax(单向客户端->服务器调用)或WebSocket(客户端->服务器和服务器->客户端调用)。

  • FullPy还提供许多高级服务,例如身份验证、翻译支持、HTML小部件系统等。

  • FullPy可以在多个后端上运行:Flask、Werkzeug和Gunicorn(仅支持Gunicorn进行WebSocket)。

简例

以下是一个FullPy Web应用程序的示例

# Server

import sys, os, os.path
from fullpy.server import *

class MyWebApp(ServerSideWebapp):
  def __init__(self):
    ServerSideWebapp.__init__(self)
    self.name          = "demo"
    self.url           = "/index.html"
    self.title         = "FullPy demo"
    self.static_folder = os.path.join(os.path.dirname(__file__), "static")

    self.use_python_client(os.path.join(os.path.dirname(__file__), "client.py"))
    self.use_ajax(debug = True)

  @rpc # Mark the function as remotely callable by the client (RPC = remote procedure call)
  def server_hello(self, session):
    return "Hello world!"

from fullpy.server.gunicorn_backend import *
serve_forever([MyWebApp()], "http://127.0.0.1:5000")
# Client

from fullpy.client import *

class MyWebApp(ClientSideWebapp):
  def on_started(self):
    def done(response):
      html = HTML("""FullPy Demo loaded Ok! Server says: '%s'.""" % response)
      html.show()
    webapp.server_hello(done) # Call the server_hello() remote function on the server

MyWebApp()

变更日志

版本 1 - 0.1

  • 初始发布

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分布

fullpy-0.1.tar.gz (4.3 MB 查看哈希值

上传时间:

支持者