2👍
Line 54 in categories/models.py:
tweetidnum=user_timeline[x]['id_str'])
That is apparently somehow trying to create a Category
instance and save it when the module is imported. This prevents the migration from running at all, as an uncaught exception is raised before the migrations get a chance to run.
You’ll have to provide more code if you want the exact cause, but that line is the culprit. I suspect it is part of a multi-line create
statement.
2👍
Your migrations weren’t applied correctly.
Do a python manage.py migrate -l categories
. It should list the applied migrations in that app. Have a look at the last one (or the one you think user_photo had to be added) and watch the file.
Once you identify which is the migration that has to add the field, do a python manage.py migrate polls $prev
where $prev is the previous migration in the list and python manage.py migrate polls $migration
where $migration is the one adding the field.
If this does not work, I would say that the fastest approach without losing data is creating the column yourself with ALTER TABLE categories ADD COLUMN "userphoto" varchar(100) NOT NULL;
- [Django]-How to send two variables with html as a JSON in Django?
- [Django]-Python manage.py runserver: TypeError: argument 1 must be str not WindowsPath
- [Django]-Django querysets order by hour, minute and seconds