Hi, i'm new to python web frameworks, but not so new to programming.
I got flaskr.py taken from tutorial https://github.com/mitsuhiko/flask/blob/master/examples/flaskr/flaskr.py
2012-08-28 17:47:13,311 :Traceback (most recent call last):
2012-08-28 17:47:13,312 : File "/usr/local/lib/python2.6/dist-packages/Flask-0.9-py2.6.egg/flask/app.py", line 1701, in __call__
2012-08-28 17:47:13,312 : return self.wsgi_app(environ, start_response)
2012-08-28 17:47:13,312 : File "/usr/local/lib/python2.6/dist-packages/Flask-0.9-py2.6.egg/flask/app.py", line 1689, in wsgi_app
2012-08-28 17:47:13,313 : response = self.make_response(self.handle_exception(e))
2012-08-28 17:47:13,313 : File "/usr/local/lib/python2.6/dist-packages/Flask-0.9-py2.6.egg/flask/app.py", line 1687, in wsgi_app
2012-08-28 17:47:13,313 : response = self.full_dispatch_request()
2012-08-28 17:47:13,313 : File "/usr/local/lib/python2.6/dist-packages/Flask-0.9-py2.6.egg/flask/app.py", line 1360, in full_dispatch_request
2012-08-28 17:47:13,314 : rv = self.handle_user_exception(e)
2012-08-28 17:47:13,314 : File "/usr/local/lib/python2.6/dist-packages/Flask-0.9-py2.6.egg/flask/app.py", line 1358, in full_dispatch_request
2012-08-28 17:47:13,314 : rv = self.dispatch_request()
2012-08-28 17:47:13,314 : File "/usr/local/lib/python2.6/dist-packages/Flask-0.9-py2.6.egg/flask/app.py", line 1344, in dispatch_request
2012-08-28 17:47:13,315 : return self.view_functions[rule.endpoint](**req.view_args)
2012-08-28 17:47:13,315 : File "/home/sztosz/flaskr/flaskr.py", line 62, in show_entries
2012-08-28 17:47:13,316 :
2012-08-28 17:47:13,316 :sqlite3.OperationalError: no such table: entries
So basically my app can't read the db, or read it and yet somehow it can't seem to find no tables in it. I try bash:
17:50 ~ $ cd flaskr/
17:50 ~/flaskr $ ls
flaskr.db flaskr.py flaskr.pyc static templates
17:50 ~/flaskr $ sqlite3 flaskr.db
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select title, text from entries;
FIRST|First entry
SECOND|second entry
sqlite>
Database exist, and it is populated, miracle :) I try Python console:
>>> db = sqlite3.connect('/home/sztosz/flaskr/flaskr.db')
>>> db
<sqlite3.Connection object at 0x190a4b8>
>>> data = db.execute('select title, text from entries')
>>> data
<sqlite3.Cursor object at 0x16d2030>
>>> for x in data.fetchall():
... print x
...
(u'FIRST', u'First entry')
(u'SECOND', u'second entry\r\n')
>>>
Another miracle :)
My question is: why is it not working normally???
http://sztosz.pythonanywhere.com/