Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Build a Social Network with Flask Takin' Names Registration View

Arihant Jain
Arihant Jain
306 Points

Getting an Error

After Running i got:
peewee.OperationalError: database is locked

You see 'social.db' that has created when you run app.py on the directory. Just delete the file. Then, you run app.py again: (python app.py). It will go through.

1 Answer

Kenneth Love answers this under the Macros video. Once you add the line "with DATABASE.transaction():" The error should go away.

@classmethod def create_user(cls, username, email, password, admin=False): try: with DATABASE.transaction(): cls.create( username=username, email=email, password=generate_password_hash(password), is_admin=admin) except IntegrityError: raise ValueError("User already exists")