[英]error after deleting app from django project
我是 Django 的新手所以請原諒我的無知......
我一直在 VS 代碼中使用 django 進行電子商務項目。 一切正常,直到我想添加帳戶功能。 從終端我做了一個 startapp 帳戶。 這樣做后不久,我決定 go 另一條路線並且不制作帳戶應用程序。 所以我通過右鍵單擊並選擇刪除選項從資源管理器中刪除了帳戶目錄。 現在,當我運行服務器以確保我沒有破壞任何東西時,我確實破壞了所有東西。 我正在使用 venv,並且我確實打開了我的 Onedrive,因為目錄保存在那里。 這是我得到的錯誤:
(Django_projects) PS C:\Users\kylec\OneDrive\Documents\school_files\team_project\Django\bookify> py manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "c:\users\kylec\appdata\local\programs\python\python39\lib\threading.py", line 954, in _bootstrap_inner
self.run()
File "c:\users\kylec\appdata\local\programs\python\python39\lib\threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\core\management\__init__.py",
line 398, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\apps\config.py", line 193, in
create
import_module(entry)
File "c:\users\kylec\appdata\local\programs\python\python39\lib\importlib\__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:\Users\kylec\OneDrive\Documents\school_files\team_project\Django\bookify\manage.py", line 22, in <module>
main()
File "C:\Users\kylec\OneDrive\Documents\school_files\team_project\Django\bookify\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\core\management\__init__.py",
line 446, in execute_from_command_line
utility.execute()
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\core\management\__init__.py",
line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\core\management\base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\core\management\commands\runserver.py", line 74, in execute
super().execute(*args, **options)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\core\management\base.py", line 448, in execute
output = self.handle(*args, **options)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\core\management\commands\runserver.py", line 111, in handle
self.run(**options)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\core\management\commands\runserver.py", line 118, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\utils\autoreload.py", line 680, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\utils\autoreload.py", line 661, in start_django
reloader.run(django_main_thread)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\utils\autoreload.py", line 344, in run
self.run_loop()
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\utils\autoreload.py", line 350, in run_loop
next(ticker)
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\utils\autoreload.py", line 390, in tick
for filepath, mtime in self.snapshot_files():
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\utils\autoreload.py", line 411, in snapshot_files
for file in self.watched_files():
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\utils\autoreload.py", line 304, in watched_files
yield from iter_all_python_module_files()
File "C:\Users\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\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\kylec\.virtualenvs\Django_projects-1wiE7bc9\lib\site-packages\django\utils\autoreload.py", line 160, in iter_modules_and_files
if not path.exists():
File "c:\users\kylec\appdata\local\programs\python\python39\lib\pathlib.py", line 1407, in exists
self.stat()
File "c:\users\kylec\appdata\local\programs\python\python39\lib\pathlib.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:\Users\kylec\OneDrive\Documents\school_files\team_project\Django\bookify>
* History restored
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\threading.py", line 954, in _bootstrap_inner
self.run()
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 398, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\apps\config.py", line 193, in create
import_module(entry)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\importlib\__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:\Users\kylec\OneDrive\Documents\school_files\team_project\Django\bookify\manage.py", line 22, in <module>
main()
File "C:\Users\kylec\OneDrive\Documents\school_files\team_project\Django\bookify\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 74, in execute
super().execute(*args, **options)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 448, in execute
output = self.handle(*args, **options)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 111, in handle
self.run(**options)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 118, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 680, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 661, in start_django
reloader.run(django_main_thread)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 344, in run
self.run_loop()
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 350, in run_loop
next(ticker)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 390, in tick
for filepath, mtime in self.snapshot_files():
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 411, in snapshot_files
for file in self.watched_files():
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 304, in watched_files
yield from iter_all_python_module_files()
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\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\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 160, in iter_modules_and_files
if not path.exists():
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 1407, in exists
self.stat()
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\pathlib.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>'
認為自從我刪除了“帳戶”后,我需要恢復所有遷移,我去了終端並嘗試了這個:py manage.py migrate account zero
以下是我得到的錯誤:
Traceback (most recent call last):
File "C:\Users\kylec\OneDrive\Documents\school_files\team_project\Django\bookify\manage.py", line 22, in <module>
main()
File "C:\Users\kylec\OneDrive\Documents\school_files\team_project\Django\bookify\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 420, in execute
django.setup()
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\site-packages\django\apps\config.py", line 193, in create
import_module(entry)
File "C:\Users\kylec\AppData\Local\Programs\Python\Python39\lib\importlib\__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'
我恢復了文件,然后打開了每個文件夾(網址、視圖等)並刪除了文件中的所有內容。 我做了 py manage.py makemigrations account 然后 py manage.py squashmigrations account
-一切都重新啟動並運行
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.