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!

Gilang Ilhami
Gilang Ilhami
12,045 Points

Had an error when i was trying to migrate songs

One of the crucial part or Django is that you must migrate every time there is a change in the models.py. In the "Django TDD" challenge, i received an error when i was trying to migrate the models.

", line 50, in emit_post_migrate_signal                                                          
    using=db)                                                                                    
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/dispatch/dispatcher.py
", line 192, in send                                                                             
    response = receiver(signal=self, sender=sender, **named)                                     
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/contrib/auth/managemen
t/__init__.py", line 85, in create_permissions                                                   
    ctype = ContentType.objects.db_manager(using).get_for_model(klass)                           
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/contrib/contenttypes/m
odels.py", line 80, in get_for_model                                                             
    "Error creating new content types. Please make sure contenttypes "                           
RuntimeError: Error creating new content types. Please make sure contenttypes is migrated before 
trying to migrate apps individually.

Because of this, i was un able to past some of the codes. Can somebody explain to me why this happened and what is the best solution for this?

My codes: https://w.trhou.se/qhviibvekw

1 Answer

codeoverload
codeoverload
24,260 Points

Just had the same problem, but I've found a fix.
You need to migrate the auth app and then try songs again.

manage.py migrate auth
manage.py migrate songs

(Found on stackoverflow: http://stackoverflow.com/a/36030740)