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 Django Basics Test Time Congratulations!

Steve Shaw
Steve Shaw
9,811 Points

Django Basics final challenge and Workspace issue

Hello, For the final Django Basics challenge, I've modified the model, view, etc. files and am ready to test them by executing the following command: python karaoke/manage.py test

However, I'm getting the following error - would appreciate if someone could help me figure out what's wrong:

treehouse:~/workspace$ python karaoke/manage.py test
Creating test database for alias 'default'...
Traceback (most recent call last):
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 323, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: songs_song

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

Traceback (most recent call last):
File "karaoke/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/core/management/init.py", line 353, in execute_from_command_line
utility.execute()
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/core/management/init.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/core/management/commands/test.py", line 30, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/core/management/commands/test.py", line 74, in execute
super(Command, self).execute(*args, **options)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/core/management/commands/test.py", line 90, in handle
failures = test_runner.run_tests(test_labels)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/test/runner.py", line 532, in run_tests
old_config = self.setup_databases()
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/test/runner.py", line 482, in setup_databases
self.parallel, **kwargs
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/test/runner.py", line 726, in setup_databases
serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/db/backends/base/creation.py", line 78, in create_test_db
self.connection.test_serialized_contents = self.serialize_db_to_string()
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/db/backends/base/creation.py", line 122, in serialize_db_to_string
serializers.serialize("json", get_objects(), indent=None, stream=out)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/core/serializers/
init.py", line 129, in serialize
s.serialize(queryset, **options)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/core/serializers/base.py", line 79, in serialize
for count, obj in enumerate(queryset, start=1):
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/db/backends/base/creation.py", line 118, in get_objects
for obj in queryset.iterator():
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/db/models/query.py", line 52, in __iter
_
results = compiler.execute_sql()
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 848, in execute_sql
cursor.execute(sql, params)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/db/utils.py", line 95, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 323, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: songs_song

Cheo R
Cheo R
37,150 Points
 I've modified the model, 

What does your code for your models look like? And have you ran makemigrations/migrate?

1 Answer

Steve Shaw
Steve Shaw
9,811 Points

Nope, hadn't run those... but they were just what the doctor ordered. Thanks, that fixed my problem!