So I have an extended User model (extended AbstractUser) called Profile. This was in a seperate app called “profiles”. I was plugging in the standard login and realised it was looking for a “profile” app name as standard, so I renamed it (directories, code, DB schema) which I thought should work. app_name was actually already set to “profile” in apps.py, so didn’t need to rename url references.

No dice. I get the error in the title.

So I removed all migrations (I’m at the stage where I can still do this OK 🙂 ) and deleted the sqlite DB that I’m currently working with, thinking I’d just rerun the migrations and recreate everything.

Same error.

The stack trace is:

λ  python manage.py makemigrations
Traceback (most recent call last):
  File "manage.py", line 21, in <module>
  File "manage.py", line 17, in main
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdjangocoremanagement__init__.py", line 381, in execute_from_command_line
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdjangocoremanagement__init__.py", line 375, in execute
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdjangocoremanagementbase.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdjangocoremanagementbase.py", line 361, in execute
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdjangocoremanagementbase.py", line 390, in check
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdjangocoremanagementbase.py", line 377, in _run_checks
    return checks.run_checks(**kwargs)
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdjangocorechecksregistry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdebug_toolbarapps.py", line 18, in check_middleware
    from debug_toolbar.middleware import DebugToolbarMiddleware
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdebug_toolbarmiddleware.py", line 12, in <module>
    from debug_toolbar.toolbar import DebugToolbar
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdebug_toolbartoolbar.py", line 141, in <module>
    urlpatterns = DebugToolbar.get_urls()
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdebug_toolbartoolbar.py", line 134, in get_urls
    for panel_class in cls.get_panel_classes():
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdebug_toolbartoolbar.py", line 116, in get_panel_classes
    import_string(panel_path) for panel_path in dt_settings.get_panels()
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdebug_toolbartoolbar.py", line 116, in <listcomp>
    import_string(panel_path) for panel_path in dt_settings.get_panels()
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdjangoutilsmodule_loading.py", line 17, in import_string
    module = import_module(module_path)
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibimportlib__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:Usersmjnic.virtualenvspyp-E_0Se9Bllibsite-packagesdebug_toolbarpanelsprofiling.py", line 1, in <module>
    import cProfile
  File "D:PythonPython37-32LibcProfile.py", line 22, in <module>
    run.__doc__ = _pyprofile.run.__doc__
AttributeError: module 'profile' has no attribute 'run'

What have I missed as part of this rename?

Any other info I’ve missed posting that would help? (I’ve searched for any instance of “profiles”, but everything is correctly renamed now, and the app was working OK prior to this, so it’s purely this rename that’s messed it up).

Edit: Can it be that “profile” conflicts with some internal python routine? That cProfile.py file under the python installation is defined as

#! /usr/bin/env python3

"""Python interface for the 'lsprof' profiler.
   Compatible with the 'profile' module.

Now that can’t be anything to do with my project? Do I just need to call my app/extended user model something other than “profile”?