bottle-pymysql-0.1.4
توضیحات
MySQL integration for Bottle.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | bottle-pymysql-0.1.4 |
| نام | bottle-pymysql |
| نسخه کتابخانه | 0.1.4 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Alexandr N. Zamaraev |
| ایمیل نویسنده | tonal@promsoft.ru |
| آدرس صفحه اصلی | https://github.com/tonal/bottle-pymysql |
| آدرس اینترنتی | https://pypi.org/project/bottle-pymysql/ |
| مجوز | MIT |
Bottle-MySQL is a plugin that integrates MySQL with your Bottle
application. It automatically connects to a database at the beginning of a
request, passes the database handle to the route callback and closes the
connection afterwards.
To automatically detect routes that need a database connection, the plugin
searches for route callbacks that require a `pymydb` keyword argument
(configurable) and skips routes that do not. This removes any overhead for
routes that don't need a database connection.
Results are returned as dictionaries.
Usage Example::
import bottle
import bottle_pymysql
app = bottle.Bottle()
# dbhost is optional, default is localhost
plugin = bottle_pymysql.Plugin(dbuser='user', dbpass='pass', dbname='db')
app.install(plugin)
@app.route('/show/:<tem>')
def show(item, pymydb):
pymydb.execute('SELECT * from items where name="%s"', (item,))
row = pymydb.fetchone()
if row:
return template('showitem', page=row)
return HTTPError(404, "Page not found")
نحوه نصب
نصب پکیج whl bottle-pymysql-0.1.4:
pip install bottle-pymysql-0.1.4.whl
نصب پکیج tar.gz bottle-pymysql-0.1.4:
pip install bottle-pymysql-0.1.4.tar.gz