Skip to main content
 首页 » 编程设计

python之Django 国家不显示国家列表

2024年10月25日32zhwl

我在 Django 国家有问题。我安装它(通过 pip),运行 makemigrations,运行迁移,并添加到我的 settings.py django-countries 中的 INSTALLED_APPS

在我的模型文件中:

from django_countries.fields import CountryField 
class Server(models.Model): 
    country = CountryField() 

但是当我在 Django 管理中创建新服务器时,我看到空选择。 我读了this和 this ,但是这本手册没有给我们任何新东西。

请告诉我,我应该怎么做才能让它发挥作用?

请您参考如下方法:

显然这是最近 3.0 版本中的一个错误: https://github.com/SmileyChris/django-countries/issues/81

恢复到 2.1.2 对我有用。