Giter Club home page Giter Club logo

bae_python_server_demo's Introduction

简介

这是基于百度应用引擎(BAE),利用python,搭建一个简单web服务的示例,主要展示对BAE的MySQL云数据库的插入及读取数据。示例中使用了webpy框架的基本功能。

本示例的应用背景是利用Arduino为中心的传感器收集环境数据到云端,通过分析数据,自动调节家电到最合适的工作状态。

功能

本示例只采用了http的GET方法,通过参数type的值判断是插入还是读取。

向数据库插入一条纪录的方法:

		http://3.jiyeqian.duapp.com/?type=put&id=t001&temperature=25

向数据库读出纪录的方法:

		http://3.jiyeqian.duapp.com/?type=get&id=t001

或者(type的默认值是get):

		http://3.jiyeqian.duapp.com/?id=t001								

注意

  • 在线编写代码时,python代码对齐引发的错误将在保存代码时给出,形如: Sorry: IndentationError: ('unexpected indent', ('/appid9g79s4e8ej/3/index.py', 56, 2, '\t c = db.cursor()
  • http访问出现internal server error是pyhon语法错误引起的。
  • BAE提供的phpMyAdmin是管理数据库的利器。

资料

建议

提供本地调试的sdk编写代码更方便。在线编写python代码对齐是个大问题,本地编写线上调试太折腾。

bae_python_server_demo's People

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.