Skip to content

AttributeError: 'NoneType' object has no attribute 'drivername' #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gowrisankar1998 opened this issue Jun 8, 2020 · 1 comment
Closed

Comments

@gowrisankar1998
Copy link

AttributeError
AttributeError: 'NoneType' object has no attribute 'drivername'

Traceback (most recent call last)
File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\sqlalchemy\util_collections.py", line 1010, in call
return self.registry[key]

During handling of the above exception, another exception occurred:

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 2463, in call
return self.wsgi_app(environ, start_response)

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py",
line 2449, in wsgi_app
response = self.handle_exception(e)

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask_compat.py", line 39, in reraise
raise value

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask_compat.py", line 39, in reraise
raise value

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 1935, in dispatch_request
return self.view_functionsrule.endpoint

File "C:\Users\my pc\3D Objects\13-Deployment-Linode\flaskblog\main\routes.py", line 11, in home
posts = Post.query.order_by(Post.date_posted.desc()).paginate(page=page, per_page=5)

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask_sqlalchemy_init_.py", line 519, in get
return type.query_class(mapper, session=self.sa.session())

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\sqlalchemy\orm\scoping.py", line 78, in call
return self.registry()

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\sqlalchemy\util_collections.py", line 1012, in call
return self.registry.setdefault(key, self.createfunc())

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\sqlalchemy\orm\session.py", line 3225, in call
return self.class_(**local_kw)

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask_sqlalchemy_init_.py", line 138, in init
bind = options.pop('bind', None) or db.engine

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask_sqlalchemy_init_.py", line 937, in engine
return self.get_engine()

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask_sqlalchemy_init_.py", line 956, in get_engine
return connector.get_engine()

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask_sqlalchemy_init_.py", line 560, in get_engine
options = self.get_options(sa_url, echo)

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask_sqlalchemy_init_.py", line 575, in get_options
self._sa.apply_driver_hacks(self._app, sa_url, options)

File "C:\Users\my pc\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask_sqlalchemy_init_.py", line 877, in apply_driver_hacks
if sa_url.drivername.startswith('mysql'):

AttributeError: 'NoneType' object has no attribute 'drivername'
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.

@gowrisankar1998
Copy link
Author

I deleted this code from the routes.py and other problems arised in code after this .Then the page started running but when clicked on login and registration "KeyError: 'A secret key is required to use CSRF." is shown

File "C:\Users\my pc\3D Objects\13-Deployment-Linode\flaskblog\main\routes.py", line 11, in home
posts = Post.query.order_by(Post.date_posted.desc()).paginate(page=page, per_page=5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant