python 基于Python Bottle的简单应用程序,用于控制Raspberry Pi相机模块

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 基于Python Bottle的简单应用程序,用于控制Raspberry Pi相机模块相关的知识,希望对你有一定的参考价值。

#!/usr/bin/python

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from bottle import post, route, request, static_file, run
import os

@route('/')
@route('/', method='POST')
def index():
	if (request.POST.get("takephoto")):
		os.system("/home/pi/takephoto.py")
	return '<h1>Hello There!</h1>  <p><img width="600" src="static/photo.jpg"></p><p> <form method="POST" action="/"><input id="btn" name="takephoto" value="Take Photo" type="submit" /></form><style>#btn { width: 11em;  height: 2em; background: #3399ff; border-radius: 5px; color: #fff; font-family: "Open Sans", sans-serif; font-size: 25px; font-weight: 900; letter-spacing: 3px; border:none; }</style></p>'

@route('/static/:path#.+#', name='static')
def static(path):
    return static_file(path, root='static')

run(host="0.0.0.0",port=8080, debug=True, reloader=True)

以上是关于python 基于Python Bottle的简单应用程序,用于控制Raspberry Pi相机模块的主要内容,如果未能解决你的问题,请参考以下文章

Python之Bottle框架使用

Python轻量级Web框架:Bottle库!

Python轻量级Web框架:Bottle库!

Python轻量级Web框架:Bottle库!

python web 开发框架之Bottle

bottle框架