为了账号安全,请及时绑定邮箱和手机立即绑定

弄templates后,就网页无法访问,出现以下错误,实在不知道怎么回事,望大神助

D:\myblog>python manage.py startapp blog2


D:\myblog>python manage.py runserver

Watching for file changes with StatReloader

Exception in thread django-main-thread:

Traceback (most recent call last):

  File "D:\an.c\lib\threading.py", line 917, in _bootstrap_inner

    self.run()

  File "D:\an.c\lib\threading.py", line 865, in run

    self._target(*self._args, **self._kwargs)

  File "D:\an.c\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper

    fn(*args, **kwargs)

  File "D:\an.c\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run

    autoreload.raise_last_exception()

  File "D:\an.c\lib\site-packages\django\utils\autoreload.py", line 77, in raise_last_exception

    raise _exception[1]

  File "D:\an.c\lib\site-packages\django\core\management\__init__.py", line 337, in execute

    autoreload.check_errors(django.setup)()

  File "D:\an.c\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper

    fn(*args, **kwargs)

  File "D:\an.c\lib\site-packages\django\__init__.py", line 24, in setup

    apps.populate(settings.INSTALLED_APPS)

  File "D:\an.c\lib\site-packages\django\apps\registry.py", line 91, in populate

    app_config = AppConfig.create(entry)

  File "D:\an.c\lib\site-packages\django\apps\config.py", line 90, in create

    module = import_module(entry)

  File "D:\an.c\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 'blogblog2'


Traceback (most recent call last):

  File "manage.py", line 21, in <module>

    main()

  File "manage.py", line 17, in main

    execute_from_command_line(sys.argv)

  File "D:\an.c\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line

    utility.execute()

  File "D:\an.c\lib\site-packages\django\core\management\__init__.py", line 375, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)

  File "D:\an.c\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv

    self.execute(*args, **cmd_options)

  File "D:\an.c\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute

    super().execute(*args, **options)

  File "D:\an.c\lib\site-packages\django\core\management\base.py", line 364, in execute

    output = self.handle(*args, **options)

  File "D:\an.c\lib\site-packages\django\core\management\commands\runserver.py", line 95, in handle

    self.run(**options)

  File "D:\an.c\lib\site-packages\django\core\management\commands\runserver.py", line 102, in run

    autoreload.run_with_reloader(self.inner_run, **options)

  File "D:\an.c\lib\site-packages\django\utils\autoreload.py", line 587, in run_with_reloader

    start_django(reloader, main_func, *args, **kwargs)

  File "D:\an.c\lib\site-packages\django\utils\autoreload.py", line 572, in start_django

    reloader.run(django_main_thread)

  File "D:\an.c\lib\site-packages\django\utils\autoreload.py", line 290, in run

    self.run_loop()

  File "D:\an.c\lib\site-packages\django\utils\autoreload.py", line 296, in run_loop

    next(ticker)

  File "D:\an.c\lib\site-packages\django\utils\autoreload.py", line 336, in tick

    for filepath, mtime in self.snapshot_files():

  File "D:\an.c\lib\site-packages\django\utils\autoreload.py", line 352, in snapshot_files

    for file in self.watched_files():

  File "D:\an.c\lib\site-packages\django\utils\autoreload.py", line 251, in watched_files

    yield from iter_all_python_module_files()

  File "D:\an.c\lib\site-packages\django\utils\autoreload.py", line 103, in iter_all_python_module_files

    return iter_modules_and_files(modules, frozenset(_error_files))

  File "D:\an.c\lib\site-packages\django\utils\autoreload.py", line 138, in iter_modules_and_files

    if not path.exists():

  File "D:\an.c\lib\pathlib.py", line 1329, in exists

    self.stat()

  File "D:\an.c\lib\pathlib.py", line 1151, in stat

    return self._accessor.stat(self)

OSError: [WinError 123] 文件名、目录名或卷标语法不正确。: '<frozen importlib._bootstrap>'


正在回答

2 回答

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'blog',
    'blog2',
]

你缺少逗号

0 回复 有任何疑惑可以回复我~

ModuleNotFoundError: No module named 'blogblog2'



0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
django入门与实践
  • 参与学习       65159    人
  • 解答问题       869    个

手把手带你进入Django开发的大门,充分领略Django的魅力

进入课程

弄templates后,就网页无法访问,出现以下错误,实在不知道怎么回事,望大神助

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信