当我想在服务器上更新我的代码时,我在python manage.py migrate
:
Traceback (most recent call last):
File "/home/ubuntu/casista-root/venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: relation "properties_property" does not exist
LINE 1: SELECT "properties_property"."locality" FROM "properties_pro...
我尝试删除所有迁移并重新创建它,但是当我执行python manage.py makemigrations
时,错误再次出现。
我也试图删除并创建数据库,但似乎永远无法解决问题。
它第一次崩溃了......我做错了吗?
更新:添加choices.py
我修复它评论下一个代码:
from properties.models import Property
CITIES = (
('any', 'Cualquiera'),
)
# cities = Property.objects.all().values_list('locality', flat=True)
# for city in cities:
# ALL_CITIES = CITIES + ((city.lower(), city),)
我不能这样做吗?我怎么能这样做?
谢谢!