Kevin Preston
Kevin Preston

Reputation: 553

Django, ModuleNotFoundError: No module named 'django_pg'

Can someone provide more details on setting up and utilizing django_pg. I would like to use the array functionality.

By following the setup of two simple steps from here: https://django-pgfields.readthedocs.io/en/latest/usage.html

Results in this error:

(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'

Upvotes: 0

Views: 1105

Answers (1)

Alasdair
Alasdair

Reputation: 308769

It looks like you forgot to do pip install django-pgfields to install it.

However, you probably shouldn’t be using this package. It hasn’t had any updates for years, so won’t support modern versions of Django.

Since Django 1.8, Django comes with django.contrib.postgres, which might provide the Postgres functionality that you require.

Upvotes: 1

Related Questions