1

Today after installing django-cryptography for encrypting all fields in my models using this website, this error is keep showing on my terminal after running python manage.py runserver:

  File "C:\Users\ADAMUDEE\Desktop\school\myv\lib\site-packages\django\core\checks\urls.py", line 24, in check_resolver
    return check_method()
  File "C:\Users\ADAMUDEE\Desktop\school\myv\lib\site-packages\django\urls\resolvers.py", line 494, in check
    for pattern in self.url_patterns:
  File "C:\Users\ADAMUDEE\Desktop\school\myv\lib\site-packages\django\utils\functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\ADAMUDEE\Desktop\school\myv\lib\site-packages\django\urls\resolvers.py", line 715, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "C:\Users\ADAMUDEE\Desktop\school\myv\lib\site-packages\django\utils\functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\ADAMUDEE\Desktop\school\myv\lib\site-packages\django\urls\resolvers.py", line 708, in urlconf_module
    return import_module(self.urlconf_name)
  File "C:\Users\ADAMUDEE\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 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\ADAMUDEE\Desktop\school\project\school\urls.py", line 23, in <module>
    path('admin/', admin.site.urls),
  File "C:\Users\ADAMUDEE\Desktop\school\myv\lib\site-packages\django\utils\functional.py", line 266, in inner
    self._setup()
  File "C:\Users\ADAMUDEE\Desktop\school\myv\lib\site-packages\django\contrib\admin\sites.py", line 595, in _setup
    AdminSiteClass = import_string(apps.get_app_config("admin").default_site)
  File "C:\Users\ADAMUDEE\Desktop\school\myv\lib\site-packages\django\apps\registry.py", line 165, in get_app_config
    raise LookupError(message)
LookupError: No installed app with label 'admin'.

I try to solve it using these answer in this question, but no one works, I also deleted sqlite in my project folder and run migrate and makemigrations again, but it does not work, is there anyone who can help please?

my settings.py:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'whitenoise.runserver_nostatic',
    'myschool',
    'crispy_forms',
    'crispy_bootstrap5',
    'bootstrap5',
    'materializecssform',
    'django_countries',
    'jsignature',
    "phonenumber_field",
]

my models:

class PrimaryAlbum(models.Model):
    name = encrypt(models.CharField(max_length=100))
    user = models.ForeignKey(User,
    on_delete=models.CASCADE)

    slug = models.SlugField(unique=True, max_length=100)


    def save(self, *args, **kwargs):
        self.slug = slugify(self.name)
        super().save(*args, **kwargs)
    

    def __str__(self):
        return self.name       

project/urls.py:

Image

2 Answers2

0

According to your error log your error is due to including admin urls. Please import your admin app in your urls file like this...

from django.contrib import admin

urlpatterns = [
   path('admin/', admin.site.urls),
]
Usama Saeed
  • 331
  • 4
  • 16
  • That is not true, check my question again, I updated it with screenshot of the file. – Bamagujen_Bahaushe. Jan 23 '23 at 18:40
  • "C:\Users\ADAMUDEE\Desktop\school\project\school\urls.py", line 23, in path('admin/', admin.site.urls)," This is the instance that refers to the admin import error in your log. According to this the error is coming from your urls file when it's trying to include admin app urls, you might need to verify your admin app in django packages – Usama Saeed Jan 23 '23 at 18:50
  • Like `Ken Whitesell` said in django forums: the version of django-cryptography I'm using is not compatible with the combination of my python and django verison, that is the reasons why i'm getting this error. – Bamagujen_Bahaushe. Jan 23 '23 at 19:37
0

I solve my problem through Ken Whitesell in django forums:

the version of django-cryptography I'm using is not compatible with the combination of my python and django verison, that is the reasons why i'm getting this error.