UnboundLocalError: local variable 'db' referenced before assignment

Posted March 29, 2021 214 views

After I run to make db.sqlite I tried to use the signup then It gave me the upper error

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.

Submit an Answer
1 answer


Can you confirm which tutorial exactly are you following and also can you share the code snippet here?

For SQLite, I could suggest the following tutorial:


by Gareth Dwyer
SQLite is a free, cross-platform database management system. It is popular for its efficiency and ability to be used with many different programming languages. In this tutorial you will install SQLite on Ubuntu 20.04. You will then create a database, read data from it, insert items, delete items, and join items from separate tables.