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 trialLeor Benari
628 PointsDjango: No such column: courses_course.description
So, I was following along, and actually got past this step. Unfortunately, I somehow lost my workspace. I maybe went to a workspace where I didn't figure everything out.
Here is my snapshot:
Thanks.
Leor Benari
628 PointsOk, so I think I got it. It didn't want the field to be null (I'm not sure why). I just selected '1', and then I assigned it to the empty string, ''.
Another quick question: What is the difference between makemigrations and migrate, and makemigrations courses and migrate courses. How is it different, and what would happen if you did it the first way, instead.
1 Answer
Chris Freeman
Treehouse Moderator 68,454 PointsDid you run makemigrations
and migrate
after adding description to the Courses
model?
Chris Freeman
Treehouse Moderator 68,454 PointsTo answer your comments
What is the difference between makemigrations and migrate,
makemigrations
is a Django management command that compares the database and your models to create "recipe" code to change the database to match changes in the models.
migrate
is a Django management command that runs the recipes to affect the changes in the database.
Running either of these commands on their own covers all apps.
makemigrations courses
andmigrate courses
. How is it different, and what would happen if you did it the first way, instead.
these run the commands on only the courses
models.
Leor Benari
628 PointsVery helpful. Thanks!!
Leor Benari
628 PointsLeor Benari
628 PointsThanks for the response. I tried that, and this is what I got:
treehouse:~/workspace/learning_site$ python manage.py makemigrations courses
You are trying to add a non-nullable field 'description' to course without a default; we can't do that (the database needs something to populate existing rows).
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows)
2) Quit, and let me add a default in models.py
Select an option: