In it, your a.py script creates your application and db objects. Notice that when a.py is run, the module is called _main_. a.py is currently running as module _main_ The results of running python a.py are the following. It can be simplified to the following explanation.Īssume you have two files in a directory.Ī.py: print 'a.py is currently running as module is done'.format(_name_) The issue here is one a gotcha in the Python import system. You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:ĭump(obj) dumps all that's known about the objectīrought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter. For code execution mouse-over the frame you want to debug and click on the console icon on the right side. From the text traceback you can also create a paste of it. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. You can now look at the traceback which led to the error. The debugger caught an exception in your WSGI application. Reraise(type(exception), exception, tb=exc_tb)įile "C:\Python27\lib\site-packages\sqlalchemy\engine\base.py", line 867, in _execute_contextįile "C:\Python27\lib\site-packages\sqlalchemy\engine\default.py", line 324, in do_execute Result = conn.execute(querycontext.statement, self._params)įile "C:\Python27\lib\site-packages\sqlalchemy\engine\base.py", line 662, in executeįile "C:\Python27\lib\site-packages\sqlalchemy\engine\base.py", line 761, in _execute_clauseelementįile "C:\Python27\lib\site-packages\sqlalchemy\engine\base.py", line 874, in _execute_contextįile "C:\Python27\lib\site-packages\sqlalchemy\engine\base.py", line 1024, in _handle_dbapi_exceptionįile "C:\Python27\lib\site-packages\sqlalchemy\util\compat.py", line 163, in raise_from_cause Return self._execute_and_instances(context)įile "C:\Python27\lib\site-packages\sqlalchemy\orm\query.py", line 2231, in _execute_and_instances Return self.view_functions(**req.view_args)įile "C:\Users\kylee\Code\GWG\gwg.py", line 20, in homepageįile "C:\Python27\lib\site-packages\sqlalchemy\orm\query.py", line 2104, in allįile "C:\Python27\lib\site-packages\sqlalchemy\orm\query.py", line 2216, in _iter_ Response = self.make_response(self.handle_exception(e))įile "C:\Python27\lib\site-packages\flask\app.py", line 1403, in handle_exceptionįile "C:\Python27\lib\site-packages\flask\app.py", line 1817, in wsgi_appįile "C:\Python27\lib\site-packages\flask\app.py", line 1477, in full_dispatch_requestįile "C:\Python27\lib\site-packages\flask\app.py", line 1381, in handle_user_exceptionįile "C:\Python27\lib\site-packages\flask\app.py", line 1475, in full_dispatch_requestįile "C:\Python27\lib\site-packages\flask\app.py", line 1461, in dispatch_request Return gi_app(environ, start_response)įile "C:\Python27\lib\site-packages\flask\app.py", line 1820, in wsgi_app OperationalError: (OperationalError) no such table: stories u'SELECT stories.id AS stories_id, stories.name AS stories_name, stories.subscribed AS stories_subscribed \nFROM stories' ()įile "C:\Python27\lib\site-packages\flask\app.py", line 1836, in _call_ Return render_template('index.html', stories=stories) Even after the error I go to /util/db/create-all and then / and still get the same error homepage(): Here is the function that seems to be triggering the error but it shouldn't because I specifically go to /util/db/create-all first and then reload /. Self.subscribed = False if self.subscribed else True Id = db.Column(db.Integer, primary_key=True) Models.py: from gwg import application, db Util = Blueprint('util', _name_, db_create_all():Īnfig = 'sqlite:///data.db' I thought I did everything correct can someone point out what I'm missing or whats wrong? It does create data.db but the file shows as 0Kb When I run gwg.py and goto /util/db/create-all it spits out an error no such table: stories. I am trying to get Flask-SQLAlchemy working and running in to some hiccups.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |