Closed amchii closed 4 years ago
Can confirm - I've just reproduced this with Django==3.0.7, django-fakery==2.3.0
. Here's my stack trace in case it's helpful:
>>> factory.m
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/tmp/tmp.dKR9G1hIik/venv/lib/python3.8/site-packages/django/utils/functional.py", line 224, in inner
self._setup()
File "/tmp/tmp.dKR9G1hIik/venv/lib/python3.8/site-packages/django/utils/functional.py", line 360, in _setup
self._wrapped = self._setupfunc()
File "/tmp/tmp.dKR9G1hIik/venv/lib/python3.8/site-packages/django_fakery/__init__.py", line 10, in <lambda>
factory = SimpleLazyObject(lambda: import_string("django_fakery.faker_factory.factory"))
File "/tmp/tmp.dKR9G1hIik/venv/lib/python3.8/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/tmp/tmp.dKR9G1hIik/venv/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/tmp/tmp.dKR9G1hIik/venv/lib/python3.8/site-packages/django_fakery/faker_factory.py", line 23, in <module>
from .values import Evaluator
File "/tmp/tmp.dKR9G1hIik/venv/lib/python3.8/site-packages/django_fakery/values.py", line 7, in <module>
from .field_mappings import STRING_FIELDS
File "/tmp/tmp.dKR9G1hIik/venv/lib/python3.8/site-packages/django_fakery/field_mappings.py", line 6, in <module>
from django.contrib.postgres import fields as pg_fields
File "/tmp/tmp.dKR9G1hIik/venv/lib/python3.8/site-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
from .array import * # NOQA
File "/tmp/tmp.dKR9G1hIik/venv/lib/python3.8/site-packages/django/contrib/postgres/fields/array.py", line 4, in <module>
from django.contrib.postgres.forms import SimpleArrayField
File "/tmp/tmp.dKR9G1hIik/venv/lib/python3.8/site-packages/django/contrib/postgres/forms/__init__.py", line 4, in <module>
from .ranges import * # NOQA
File "/tmp/tmp.dKR9G1hIik/venv/lib/python3.8/site-packages/django/contrib/postgres/forms/ranges.py", line 3, in <module>
from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange
ModuleNotFoundError: No module named 'psycopg2'
My guess is that this import is causing the issue: https://github.com/fcurella/django-fakery/blob/master/django_fakery/field_mappings.py#L6
Hi! Thank you for the report!
I've released v2.3.1, which should fix the problem. Let me know if you find any issues :)
New release looks good - thanks for quick fix :+1:
Thanks for your nice package.
Steps to reproduce
pip install django-fakery
In [2]: factory.m
ModuleNotFoundError: No module named 'psycopg2'