Hi guys,
I'm new ish to python and am following a Udemy course for REST API's in Flask.
I keep getting the error message mentioned in the title when I try and send a POST request to the auth endpoint. The full message is below.
2019-06-07 12:49:20,070: Exception on /auth [POST]
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python3.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python3.7/site-packages/flask_restful/__init__.py", line 273, in error_router
return original_handler(e)
File "/usr/lib/python3.7/site-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/usr/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/collardesolate/.local/lib/python3.7/site-packages/flask_jwt/__init__.py", line 122, in _default_auth_request_handler
identity = _jwt.authentication_callback(username, password)
File "/home/collardesolate/mysite/security.py", line 6, in authenticate
user = User.find_by_username(username)
File "/home/collardesolate/mysite/user.py", line 16, in find_by_username
result = cursor.execute(query, (username,))
sqlite3.OperationalError: no such table: users
I'm not running a virtualenv. I have 100% already created the table. I have downloaded the DB file and viewed it in an SQLite viewer and I can see the rows there and it is called 'users'.
Please can anyone help? I have googled this as well as searching on here but couldn't find anything Flask specific and am so confused because I have 100% created the table it is looking for before I run the POST request. I have also gone forward and did copy all the code from the Udemy course directly and still hit with a 500 error, so I'm thinking it might be something PythonAnywhere specific?
As a newbie I'm not quite sure what code you would need to help debug this and I don't want to clog this post up with loads of code for now hoping that the PythonAnywhere team can just view my files. Please ask if you want the file and PythonAnywhere staff, you have my permission to view my files!
Thanks very much in advance.