I am trying to make simple webpage that will read data from SQLite file and show it in webpage, it is very simple I want to do 3 SQL query and show result.
I have idea to use Brython for it, because it look easier that to make Django/Flask app,
This is my code:
<html>
<head>
<script src="/brython.js"></script>
</head>
<body onload="brython('debug_mode')"> <!-- for debug --!>
<script type="text/python">
from browser import document, alert
from browser import html
def echo(ev):
alert(document["zone"].value)
document['mybutton'].bind('click',echo)
document['text'] <= html.P("testing")
document['text'] <= html.P("testing 222")
# get holidays for today
import sqlite3
import sys
sqlite3_connection = sqlite3.connect('test.db')
with sqlite3_connection:
sqlite3_cursor = sqlite3_connection.cursor()
sqlite3_cursor.execute('SELECT SQLITE_VERSION()')
data = sqlite3_cursor.fetchone()
document['text'] <= html.P("SQLite version: %s" % data)
</script>
<input id="zone"><button id="mybutton">click !</button>
<div id="text">
</div>
</body>
</html>
This is not working, problem is Brython does not have sqlite3 implementation by default.
Is there some easy way to add sqlite3 to Brython ?
I have seen that there has been some Google summer of Code project for it, but have not found results anywhere.