Giter VIP home page Giter VIP logo

modern-python-workshop's People

Contributors

switowski avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

modern-python-workshop's Issues

'SQLalchemy.exc.OperationalError: no such table: task'

  • Serving Flask app "run.py"
  • Environment: development
  • Debug mode: on
  • Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

127.0.0.1 - - [04/Sep/2020 09:23:27] "GET / HTTP/1.1" 500 -
Error on request:
Traceback (most recent call last):
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute
cursor.execute(statement, parameters)
sqlite3.OperationalError: no such table: task

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/werkzeug/serving.py", line 323, in run_wsgi
execute(self.server.app)
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/werkzeug/serving.py", line 312, in execute
application_iter = app(environ, start_response)
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/flask/app.py", line 2463, in call
return self.wsgi_app(environ, start_response)
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/flask/app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/flask/app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File "/Users/justingold/Development/ToDoList/todo/views.py", line 11, in tasks_list
tasks = get_tasks()
File "/Users/justingold/Development/ToDoList/todo/api.py", line 7, in get_tasks
return Task.query.all()
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3346, in all
return list(self)
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3508, in iter
return self._execute_and_instances(context)
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3533, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1011, in execute
return meth(self, multiparams, params)
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1124, in _execute_clauseelement
ret = self._execute_context(
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context
self.handle_dbapi_exception(
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1510, in handle_dbapi_exception
util.raise
(
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 182, in raise

raise exception
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "/Users/justingold/.pyenv/versions/3.8.5/envs/ToDoList/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: task
[SQL: SELECT task.id AS task_id, task.body AS task_body, task.done AS task_done
FROM task]

I am trying to run the Flask app cookie-cutter (with scaffolding) out of the box. I am not sure how to fix this error; my best guess is the imports cause the 'tasks_list' view to run prior to db.create_all() and therefore it is trying to query an entirely empty database. But the imports/route is the same as the finished product, so I'd think that would work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.