Python 3, Django 1.8.5, Postgres
I have a model Sites
that has been working fine. I recently tried to add a field, airport_code, and migrate the data.>
I got the same issue, here is my case:
in the app MyApp
I add a new field to the model:
class Advisors(models.Model):
AdvID = models.IntegerField(primary_key=True)
Name = models.CharField(max_length=200,null=False)
ParentID = models.IntegerField(null=True) # <--- the NEW field I add
so what I did is:
in the urls.py
of MyProject
, NOT MyApp
, comment out the url() linked to MyApp
and then do makemigrations
and migrate
everything goes well;
in MyApp/urls.py
file:
urlpatterns = [
url(r'^admin/', admin.site.urls, name='admin'),
url(r'^$', views.HomePage.as_view(),name='home'),
#comment out the following line, after migrate success, bring it back;
# url(r'^myapp/', include('myapp.urls',namespace='research')), <---
]