Django,ModuleNotFoundError:没有名为“ django_pg”的模块

时间:2019-03-13 01:00:36

标签: django postgresql

有人可以提供有关设置和使用django_pg的更多详细信息。我想使用 array功能

按照以下两个简单步骤进行设置: https://django-pgfields.readthedocs.io/en/latest/usage.html

导致此错误:

(environment) jeff@jeff-computer:~/environment/projectA$ python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/home/jeff/environment/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/jeff/environment/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/home/jeff/environment/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/jeff/environment/lib/python3.7/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/home/jeff/environment/lib/python3.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/home/jeff/miniconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_pg'

1 个答案:

答案 0 :(得分:1)

您好像忘记了pip install django-pgfields来安装它。

但是,您可能不应该使用此软件包。多年来没有任何更新,因此将不支持现代版本的Django。

自Django 1.8起, Django随附django.contrib.postgres,它可能提供您所需的Postgres功能。