Models PhoneNumberField Not Recognizing

thank you very much for your help.
i had restframework api application and i want to store user phone number but wouldn't store it as CharField or TextField. i want to use PhoneNumberField django package.

I got installed:

django-phonenumber-field==5.0.0
phonenumberslite==8.12.11

but still i got this err in makemigrations my project

Traceback (most recent call last):
  File "C:\Users\moham\OneDrive\Projects\UpMenu\manage.py", line 24, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\moham\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "C:\Users\moham\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 357, in execute
    django.setup()
  File "C:\Users\moham\AppData\Local\Programs\Python\Python310\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\moham\AppData\Local\Programs\Python\Python310\lib\site-packages\django\apps\registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "C:\Users\moham\AppData\Local\Programs\Python\Python310\lib\site-packages\django\apps\config.py", line 90, in create
    module = import_module(entry)
  File "C:\Users\moham\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'phonenumber_field'

That's my models.py:

import uuid
from django.db import models
from phonenumber_field.modelfields import PhoneNumberField

# Create your models here.


class Users(models.Model):
    owner = models.ForeignKey(
        "auth.User", related_name="snippets", on_delete=models.CASCADE, null=True
    )
    Id = models.UUIDField(
        default=uuid.uuid4, unique=True, primary_key=True, editable=False
    )
    Email = models.EmailField(unique=True)
    Password = models.CharField(max_length=50)
    FirstName = models.CharField(max_length=50)
    LastName = models.CharField(max_length=50)
    Address = models.CharField(max_length=250)
    CellPhone = PhoneNumberField()
    EmailActiveCode = models.BooleanField(default=False)
    IsActived = models.BooleanField(default=False)
    IsDelete = models.BooleanField(default=False)
    CreatedDate = models.DateTimeField(auto_now_add=True)
    LastUpdateDate = models.DateTimeField(auto_now_add=True)

    class Meta:
        ordering = ["CreatedDate"]

According to docs you forgot about that:

INSTALLED_APPS = [
    ...
    'phonenumber_field',
    ...
]
Back to Top