从django项目中删除app后出现错误



我是Django的新手,所以请原谅我的无知…

我一直在做一个电子商务项目与django在VS code。一切都很顺利,直到我想添加一个帐户功能。我在终端上创建了一个startapp账户。这样做后不久,我决定走另一条路,不做一个帐户应用程序。所以我从浏览器中删除了帐户目录,右键单击并选择删除选项。现在,当我运行服务器以确保我没有破坏任何东西时,我确实破坏了所有东西。我正在使用venv,我确实有我的oneddrive打开,因为目录保存在那里。这是我得到的错误:

(Django_projects) PS C:UserskylecOneDriveDocumentsschool_filesteam_projectDjangobookify> py manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "c:userskylecappdatalocalprogramspythonpython39libthreading.py", line 954, in _bootstrap_inner      
self.run()
File "c:userskylecappdatalocalprogramspythonpython39libthreading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoutilsautoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangocoremanagementcommandsrunserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoutilsautoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangocoremanagement__init__.py", 
line 398, in execute
autoreload.check_errors(django.setup)()
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoutilsautoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjango__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoappsregistry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoappsconfig.py", line 193, in 
create
import_module(entry)
File "c:userskylecappdatalocalprogramspythonpython39libimportlib__init__.py", line 127, in import_module    return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'account'
Traceback (most recent call last):
File "C:UserskylecOneDriveDocumentsschool_filesteam_projectDjangobookifymanage.py", line 22, in <module>
main()
File "C:UserskylecOneDriveDocumentsschool_filesteam_projectDjangobookifymanage.py", line 18, in main     
execute_from_command_line(sys.argv)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangocoremanagement__init__.py", 
line 446, in execute_from_command_line
utility.execute()
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangocoremanagement__init__.py", 
line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangocoremanagementbase.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangocoremanagementcommandsrunserver.py", line 74, in execute
super().execute(*args, **options)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangocoremanagementbase.py", line 448, in execute
output = self.handle(*args, **options)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangocoremanagementcommandsrunserver.py", line 111, in handle
self.run(**options)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangocoremanagementcommandsrunserver.py", line 118, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoutilsautoreload.py", line 680, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoutilsautoreload.py", line 661, in start_django
reloader.run(django_main_thread)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoutilsautoreload.py", line 344, in run
self.run_loop()
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoutilsautoreload.py", line 350, in run_loop
next(ticker)
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoutilsautoreload.py", line 390, in tick
for filepath, mtime in self.snapshot_files():
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoutilsautoreload.py", line 411, in snapshot_files
for file in self.watched_files():
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoutilsautoreload.py", line 304, in watched_files
yield from iter_all_python_module_files()
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoutilsautoreload.py", line 120, in iter_all_python_module_files
return iter_modules_and_files(modules, frozenset(_error_files))
File "C:Userskylec.virtualenvsDjango_projects-1wiE7bc9libsite-packagesdjangoutilsautoreload.py", line 160, in iter_modules_and_files
if not path.exists():
File "c:userskylecappdatalocalprogramspythonpython39libpathlib.py", line 1407, in exists
self.stat()
File "c:userskylecappdatalocalprogramspythonpython39libpathlib.py", line 1221, in stat
return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>'
(Django_projects) PS C:UserskylecOneDriveDocumentsschool_filesteam_projectDjangobookify> 
*  History restored 
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:UserskylecAppDataLocalProgramsPythonPython39libthreading.py", line 954, in _bootstrap_inner
self.run()
File "C:UserskylecAppDataLocalProgramsPythonPython39libthreading.py", line 892, in run        
self._target(*self._args, **self._kwargs)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoutilsautoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangocoremanagementcommandsrunserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoutilsautoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangocoremanagement__init__.py", line 398, in execute
autoreload.check_errors(django.setup)()
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoutilsautoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjango__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoappsregistry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoappsconfig.py", line 193, in create
import_module(entry)
File "C:UserskylecAppDataLocalProgramsPythonPython39libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'account'
Traceback (most recent call last):
File "C:UserskylecOneDriveDocumentsschool_filesteam_projectDjangobookifymanage.py", line 22, in <module>
main()
File "C:UserskylecOneDriveDocumentsschool_filesteam_projectDjangobookifymanage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangocoremanagement__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangocoremanagement__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangocoremanagementbase.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangocoremanagementcommandsrunserver.py", line 74, in execute
super().execute(*args, **options)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangocoremanagementbase.py", line 448, in execute
output = self.handle(*args, **options)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangocoremanagementcommandsrunserver.py", line 111, in handle
self.run(**options)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangocoremanagementcommandsrunserver.py", line 118, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoutilsautoreload.py", line 680, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoutilsautoreload.py", line 661, in start_django
reloader.run(django_main_thread)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoutilsautoreload.py", line 344, in run
self.run_loop()
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoutilsautoreload.py", line 350, in run_loop
next(ticker)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoutilsautoreload.py", line 390, in tick
for filepath, mtime in self.snapshot_files():
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoutilsautoreload.py", line 411, in snapshot_files
for file in self.watched_files():
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoutilsautoreload.py", line 304, in watched_files
yield from iter_all_python_module_files()
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoutilsautoreload.py", line 120, in iter_all_python_module_files
return iter_modules_and_files(modules, frozenset(_error_files))
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoutilsautoreload.py", line 160, in iter_modules_and_files
if not path.exists():
File "C:UserskylecAppDataLocalProgramsPythonPython39libpathlib.py", line 1407, in exists      
self.stat()
File "C:UserskylecAppDataLocalProgramsPythonPython39libpathlib.py", line 1221, in stat        
return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>'

想着自从我删除了"账号"我需要还原我到终端的所有迁移并尝试如下:

下面是我得到的错误:

Traceback (most recent call last):
File "C:UserskylecOneDriveDocumentsschool_filesteam_projectDjangobookifymanage.py", line 22, in <module>
main()
File "C:UserskylecOneDriveDocumentsschool_filesteam_projectDjangobookifymanage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangocoremanagement__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangocoremanagement__init__.py", line 420, in execute
django.setup()
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjango__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoappsregistry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:UserskylecAppDataLocalProgramsPythonPython39libsite-packagesdjangoappsconfig.py", line 193, in create
import_module(entry)
File "C:UserskylecAppDataLocalProgramsPythonPython39libimportlib__init__.py", line 127, in import_module
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'account'

我恢复了文件,然后打开每个文件夹(url,视图等)并删除了文件中的所有内容。我做了py management .py makemigmigrations帐户然后是py management .py squashmigrations帐户

-一切正常

最新更新