Django runserver error

Salut,

Ma poate ajuta cineva cu resolvarea erorii de mai jos?

Link github: GitHub - hanuionut94/django_app

> (django_env) PS D:\python visio\django_app\app> python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\threading.py", line 926, in _bootstrap_inner      
    self.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\commands\runserver.py", line 110, in inner_run
    autoreload.raise_last_exception()
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\__init__.py", line 375, in execute
    autoreload.check_errors(django.setup)()
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\apps\registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\apps\config.py", line 224, in create
    import_module(entry)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'app.bankapp'

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\commands\runserver.py", line 61, in execute
    super().execute(*args, **options)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\commands\runserver.py", line 96, in handle
    self.run(**options)
(django_env) PS D:\python visio\django_app\app> 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:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\threading.py", line 926, in _bootstrap_inner
    self.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\commands\runserver.py", line 118, in inner_run
    self.check(display_num_errors=True)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\base.py", line 423, in check
    databases=databases,
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\checks\registry.py", line 76, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
    return check_method()
  File "D:\python visio\django_app\django_env\lib\site-packages\django\urls\resolvers.py", line 416, in check
    for pattern in self.url_patterns:
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\urls\resolvers.py", line 602, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\urls\resolvers.py", line 595, in urlconf_module
    return import_module(self.urlconf_name)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\python visio\django_app\app\app\urls.py", line 21, in <module>
    path("bankapp/", include('bankapp/urls'))
  File "D:\python visio\django_app\django_env\lib\site-packages\django\urls\conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'bankapp/urls'

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\commands\runserver.py", line 61, in execute
    super().execute(*args, **options)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\commands\runserver.py", line 96, in handle
    self.run(**options)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\core\management\commands\runserver.py", line 103, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\autoreload.py", line 638, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\autoreload.py", line 623, in start_django
    reloader.run(django_main_thread)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\autoreload.py", line 329, in run
    self.run_loop()
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\autoreload.py", line 335, in run_loop
    next(ticker)
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\autoreload.py", line 375, in tick
    for filepath, mtime in self.snapshot_files():
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\autoreload.py", line 391, in snapshot_files
    for file in self.watched_files():
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\autoreload.py", line 289, in watched_files
    yield from iter_all_python_module_files()
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\autoreload.py", line 116, in iter_all_python_module_files
    return iter_modules_and_files(modules, frozenset(_error_files))
  File "D:\python visio\django_app\django_env\lib\site-packages\django\utils\autoreload.py", line 152, in iter_modules_and_files
    if not path.exists():
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\pathlib.py", line 1361, in exists
    self.stat()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\pathlib.py", line 1183, in stat
    return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>'

N-am sa inteleg niciodata de ce insista lumea sa dezvolte php si python pe windows, cand ele vor rula in productie pe linux.

Asta iti e eroarea.
Citeste mai bine comentariile din fisierul django_app/app/app/urls.py at master · hanuionut94/django_app · GitHub ca sa intelegi cum trebuie folosit.

Pe github ai un folder django_env, ala nu se comite in version control. Doar requirements.txt sau pyproject.toml sau Pipenv file.
La fel ai pus tot felul de fisiere specifice python, nici alea nu se pun in version control. Inspira-te de aici ca sa stii ce alte lucruri nu se pun in repository: gitignore/Python.gitignore at main · github/gitignore · GitHub

4 Likes

Dintr-un motiv foarte simplu: comoditate.

Vreau să nu am probleme cu sunetul, sau să am măcar o aplicație de grafică vag decentă. (nu, Gimp nu intră în categoria asta). Sau să am Spotify, Slack, Teams, OneDrive funcționale. Chestii de genul.

Sau dacă spui de Mac: nu vreau să înjur zilnic decizii de UI.

WSL e perfect pentru asta

3 Likes

am rezolvat, am scris gresit. trebuia ‘bankapp.urls’