Error when following how to add authentication to your app with flask login tutorial

I had a lot of issue while doing this, I had searched a lot but couldn’t find anything. Please see my question

i was creating a server of login verification but after connecting it to the db, i was facing a lot of issue

my error -

[* Serving Flask app "project"
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\flask_sqlalchemy\ FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.
  'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
 * Running on (Press CTRL+C to quit)
[2020-05-13 17:34:35,237] ERROR in app: Exception on /signup [POST]
Traceback (most recent call last):
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\engine\", line 1248, in _execute_context
    cursor, statement, parameters, context
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\engine\", line 590, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: no such table: user

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

Traceback (most recent call last):
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\flask\", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\flask\", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\flask\", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\flask\", line 39, in reraise
    raise value
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\flask\", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\flask\", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\python\login\project\", line 26, in signup_post
    user = User.query.filter_by(email=email).first() # if this returns a user, then the email already exists in database
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\orm\", line 3300, in first
    ret = list(self[0:1])
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\orm\", line 3078, in __getitem__
    return list(res)
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\orm\", line 3405, in __iter__
    return self._execute_and_instances(context)
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\orm\", line 3430, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\engine\", line 984, in execute
    return meth(self, multiparams, params)
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\sql\", line 293, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\engine\", line 1103, in _execute_clauseelement
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\engine\", line 1288, in _execute_context
    e, statement, parameters, cursor, context
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\engine\", line 1482, in _handle_dbapi_exception
    sqlalchemy_exception, with_traceback=exc_info[2], from_=e
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\util\", line 178, in raise_
    raise exception
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\engine\", line 1248, in _execute_context
    cursor, statement, parameters, context
  File "c:\users\siddharth\appdata\local\programs\python\python37-32\lib\site-packages\sqlalchemy\engine\", line 590, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user
[SQL: SELECT AS user_id, AS user_email, user.password AS user_password, AS user_name
FROM user
[parameters: ('', 1, 0)]
(Background on this error at: - - [13/May/2020 17:34:35] "?[35m?[1mPOST /signup HTTP/1.1?[0m" 500 -]

here is full my code -

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hey @mailtoshashwata,

Your error here is that the user table doesn’t exist in the database.

sqlite3.OperationalError: no such table: user

Have you created the user model in your app and then generated the database using SQLAlchemy as described in these steps of the tutorial?:

- Matt.