Home > front end >  django runserver returns error when i run py manage.py runserver on a project my friends did how can
django runserver returns error when i run py manage.py runserver on a project my friends did how can

Time:02-05

I wanted to open a Django file my friends did and I installed Django MySQL client etc.. but run server doesn't work, it works when I run my own other file so here's the error and SQL code I pip installed MySQL connector As well but it still didn't change anything do you guys have any suggestions to why the run server is encountering this problem?

Requirement already satisfied: mysqlclient in c:\users\user\appdata\local\programs\python\python310\lib\site-packages (2.1.0)

C:\Users\user>cd documents

C:\Users\user\Documents>cd one_art

C:\Users\user\Documents\one_art>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run
    self.check(display_num_errors=True)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 392, in check
    all_issues = self._run_checks(
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 382, in _run_checks
    return checks.run_checks(**kwargs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\checks\urls.py", line 40, in check_url_namespaces_unique
    all_namespaces = _load_all_namespaces(resolver)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\checks\urls.py", line 57, in _load_all_namespaces
    url_patterns = getattr(resolver, 'url_patterns', [])
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\django\urls\resolvers.py", line 588, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\django\urls\resolvers.py", line 581, in urlconf_module
    return import_module(self.urlconf_name)
  File "C:\Users\user\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\user\Documents\one_art\one_art\urls.py", line 23, in <module>
    path('', include('gallery.urls'))
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\django\urls\conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "C:\Users\user\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\user\Documents\one_art\gallery\urls.py", line 4, in <module>
    from . import views
  File "C:\Users\user\Documents\one_art\gallery\views.py", line 6, in <module>
    from .forms import *
  File "C:\Users\user\Documents\one_art\gallery\forms.py", line 3, in <module>
    from attr import field
ModuleNotFoundError: No module named 'attr'

the file runs on my friends computer but not mine

the sql code:-

    create user one_art_admin identified by 'Horriblebob11';
    grant all on one_art.* to one_art_admin;
    flush privileges;

CodePudding user response:

It says attr module not found Try to install the module:

     pip install attr

Then run again.

CodePudding user response:

From the looks of Traceback, it is not SQL client issue. It is an error of missing library attr.

ModuleNotFoundError: No module named 'attr'

you can refer to this link to resolve the issue. ImportError: No module named attr

  •  Tags:  
  • Related