Hello. I used Miguel Grinberg’s Flask Microblog for a project of mine. I downloaded the latest version and opened it in visual studio code . I downloaded the necessary libraries and set up the virtual environment. When I start it up, for example when I want to register a user, I get the
<code>OperationalError
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user
[SQL: SELECT user.id, user.username, user.email, user.password_hash, user.about_me, user.last_seen, user.last_message_read_time, user.token, user.token_expiration
FROM user
WHERE user.username = ?]
[parameters: ('a',)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
Traceback (most recent call last)
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1969, in _exec_single_context
self.dialect.do_execute(
^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginedefault.py", line 922, in do_execute
cursor.execute(statement, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The above exception was the direct cause of the following exception:
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 1478, in __call__
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 1458, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 1455, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 867, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23appauthroutes.py", line 44, in register
if form.validate_on_submit():
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflask_wtfform.py", line 86, in validate_on_submit
return self.is_submitted() and self.validate(extra_validators=extra_validators)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packageswtformsform.py", line 329, in validate
return super().validate(extra)
^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packageswtformsform.py", line 146, in validate
if not field.validate(self, extra):
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packageswtformsfieldscore.py", line 246, in validate
stop_validation = self._run_validation_chain(form, chain)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packageswtformsfieldscore.py", line 266, in _run_validation_chain
validator(form, self)
^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23appauthforms.py", line 27, in validate_username
user = db.session.scalar(sa.select(User).where(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyormscoping.py", line 1859, in scalar
return self._proxied.scalar(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyormsession.py", line 2358, in scalar
return self._execute_internal(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyormsession.py", line 2190, in _execute_internal
result: Result[Any] = compile_state_cls.orm_execute_statement(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyormcontext.py", line 293, in orm_execute_statement
result = conn.execute(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1416, in execute
return meth(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemysqlelements.py", line 516, in _execute_on_connection
return connection._execute_clauseelement(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1639, in _execute_clauseelement
ret = self._execute_context(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1848, in _execute_context
return self._exec_single_context(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1988, in _exec_single_context
self._handle_dbapi_exception(
^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 2343, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1969, in _exec_single_context
self.dialect.do_execute(
^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginedefault.py", line 922, in do_execute
cursor.execute(statement, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user
[SQL: SELECT user.id, user.username, user.email, user.password_hash, user.about_me, user.last_seen, user.last_message_read_time, user.token, user.token_expiration
FROM user
WHERE user.username = ?]
[parameters: ('a',)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.
</code>
<code>OperationalError
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user
[SQL: SELECT user.id, user.username, user.email, user.password_hash, user.about_me, user.last_seen, user.last_message_read_time, user.token, user.token_expiration
FROM user
WHERE user.username = ?]
[parameters: ('a',)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
Traceback (most recent call last)
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1969, in _exec_single_context
self.dialect.do_execute(
^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginedefault.py", line 922, in do_execute
cursor.execute(statement, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The above exception was the direct cause of the following exception:
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 1478, in __call__
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 1458, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 1455, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 867, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23appauthroutes.py", line 44, in register
if form.validate_on_submit():
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflask_wtfform.py", line 86, in validate_on_submit
return self.is_submitted() and self.validate(extra_validators=extra_validators)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packageswtformsform.py", line 329, in validate
return super().validate(extra)
^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packageswtformsform.py", line 146, in validate
if not field.validate(self, extra):
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packageswtformsfieldscore.py", line 246, in validate
stop_validation = self._run_validation_chain(form, chain)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packageswtformsfieldscore.py", line 266, in _run_validation_chain
validator(form, self)
^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23appauthforms.py", line 27, in validate_username
user = db.session.scalar(sa.select(User).where(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyormscoping.py", line 1859, in scalar
return self._proxied.scalar(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyormsession.py", line 2358, in scalar
return self._execute_internal(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyormsession.py", line 2190, in _execute_internal
result: Result[Any] = compile_state_cls.orm_execute_statement(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyormcontext.py", line 293, in orm_execute_statement
result = conn.execute(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1416, in execute
return meth(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemysqlelements.py", line 516, in _execute_on_connection
return connection._execute_clauseelement(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1639, in _execute_clauseelement
ret = self._execute_context(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1848, in _execute_context
return self._exec_single_context(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1988, in _exec_single_context
self._handle_dbapi_exception(
^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 2343, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1969, in _exec_single_context
self.dialect.do_execute(
^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginedefault.py", line 922, in do_execute
cursor.execute(statement, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user
[SQL: SELECT user.id, user.username, user.email, user.password_hash, user.about_me, user.last_seen, user.last_message_read_time, user.token, user.token_expiration
FROM user
WHERE user.username = ?]
[parameters: ('a',)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.
</code>
OperationalError
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user
[SQL: SELECT user.id, user.username, user.email, user.password_hash, user.about_me, user.last_seen, user.last_message_read_time, user.token, user.token_expiration
FROM user
WHERE user.username = ?]
[parameters: ('a',)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
Traceback (most recent call last)
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1969, in _exec_single_context
self.dialect.do_execute(
^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginedefault.py", line 922, in do_execute
cursor.execute(statement, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The above exception was the direct cause of the following exception:
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 1478, in __call__
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 1458, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 1455, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 867, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflaskapp.py", line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23appauthroutes.py", line 44, in register
if form.validate_on_submit():
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagesflask_wtfform.py", line 86, in validate_on_submit
return self.is_submitted() and self.validate(extra_validators=extra_validators)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packageswtformsform.py", line 329, in validate
return super().validate(extra)
^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packageswtformsform.py", line 146, in validate
if not field.validate(self, extra):
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packageswtformsfieldscore.py", line 246, in validate
stop_validation = self._run_validation_chain(form, chain)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packageswtformsfieldscore.py", line 266, in _run_validation_chain
validator(form, self)
^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23appauthforms.py", line 27, in validate_username
user = db.session.scalar(sa.select(User).where(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyormscoping.py", line 1859, in scalar
return self._proxied.scalar(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyormsession.py", line 2358, in scalar
return self._execute_internal(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyormsession.py", line 2190, in _execute_internal
result: Result[Any] = compile_state_cls.orm_execute_statement(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyormcontext.py", line 293, in orm_execute_statement
result = conn.execute(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1416, in execute
return meth(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemysqlelements.py", line 516, in _execute_on_connection
return connection._execute_clauseelement(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1639, in _execute_clauseelement
ret = self._execute_context(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1848, in _execute_context
return self._exec_single_context(
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1988, in _exec_single_context
self._handle_dbapi_exception(
^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 2343, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginebase.py", line 1969, in _exec_single_context
self.dialect.do_execute(
^
File "D:megitacmicroblog-0.23venvLibsite-packagessqlalchemyenginedefault.py", line 922, in do_execute
cursor.execute(statement, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user
[SQL: SELECT user.id, user.username, user.email, user.password_hash, user.about_me, user.last_seen, user.last_message_read_time, user.token, user.token_expiration
FROM user
WHERE user.username = ?]
[parameters: ('a',)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.
**error. I’m no expert on this so I don’t know how to fix this. I just downloaded the microblog file from this address and opened it in visual studio code. I installed the packages in the Requirements.txt file to the virtual environment.
I found a page where this question had been asked before, but the source I used was not used. That’s why I created a new topic. Sorry for recreating it. I’m waiting for your help.
I expected this web application to run smoothly when I installed and ran the packages correctly, but I encountered the error I mentioned.**
New contributor
emre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.