DatabaseError: no such column error

后端 未结 3 694
醉话见心
醉话见心 2021-02-02 01:08

So I have a model that I wanted to add ImageField to, so I typed in picture = models.ImageField(upload_to=\'media/images\')

I then ran syncdb and went into the shell

3条回答
  •  礼貌的吻别
    2021-02-02 01:36

    There are two possibilities that to get this error 1) You added extra field to model after doing the syncdb. 2) you added new class to model.py file in django.

    Solution for this is:

    First install south by using command

    for windows: **easy_install south**     //for that you need to go to the script folder of python folder in c drive.
    
    for linux: **sudo easy_install south**  
    

    Then follow the steps which are included here migration tutorials

    step1- python manage.py schemamigration your_app_name --initial

    step-2 python manage.py migrate your_app_name Hope this will help you.

提交回复
热议问题