运行 python manage.py runserver

Traceback (most recent call last):
  File "C:\Program Files\python\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Program Files\python\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
    autoreload.raise_last_exception()
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\core\management\__init__.py", line 398, in execute
    autoreload.check_errors(django.setup)()
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\apps\registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\apps\config.py", line 228, in create
    import_module(entry)
  File "C:\Program Files\python\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'bootstrap4'
Traceback (most recent call last):
  File "manage.py", line 23, in <module>
    main()
  File "manage.py", line 19, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\core\management\__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\core\management\base.py", line 414, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\core\management\commands\runserver.py", line 74, in execute
    super().execute(*args, **options)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\core\management\base.py", line 460, in execute
    output = self.handle(*args, **options)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\core\management\commands\runserver.py", line 111, in handle
    self.run(**options)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\core\management\commands\runserver.py", line 118, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 680, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 661, in start_django
    reloader.run(django_main_thread)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 344, in run
    self.run_loop()
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 350, in run_loop
    next(ticker)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 390, in tick
    for filepath, mtime in self.snapshot_files():
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 411, in snapshot_files
    for file in self.watched_files():
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 304, in watched_files
    yield from iter_all_python_module_files()
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 120, in iter_all_python_module_files
    return iter_modules_and_files(modules, frozenset(_error_files))
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\django\utils\autoreload.py", line 160, in iter_modules_and_files
    if not path.exists():
  File "C:\Program Files\python\lib\pathlib.py", line 1391, in exists
    self.stat()
  File "C:\Program Files\python\lib\pathlib.py", line 1197, in stat
    return self._accessor.stat(self)
OSError: [WinError 123] 文件名、目录名或卷标语法不正确。: '<frozen importlib._bootstrap>'

pip install django-bootstrap4

再次运行 python manage.py runserver

解决

分类:
后端
  •