- 姜戈 1.6
- Ubuntu 12.04
- Python 3.2.3
意外删除了 Django 应用程序的__pycache__
文件夹及其__init__.py
文件,导致 Django 崩溃。当 I 时python3 manage.py runserver
,它会立即声称没有名为agepct的模块,即使应用程序的目录存在并且所有文件都在其中(我删除的文件除外)。我清空了垃圾箱,所以我无法取回文件。除了从头开始重新创建整个应用程序之外,有什么方法可以让应用程序再次运行?
这是我尝试时吐出的回溯runserver
:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.2/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.2/dist-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.2/dist-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python3.2/dist-packages/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/usr/local/lib/python3.2/dist-packages/django/utils/translation/__init__.py", line 130, in activate
return _trans.activate(language)
File "/usr/local/lib/python3.2/dist-packages/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/usr/local/lib/python3.2/dist-packages/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/usr/local/lib/python3.2/dist-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/usr/lib/python3.2/importlib/__init__.py", line 124, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/usr/lib/python3.2/importlib/_bootstrap.py", line 824, in _gcd_import
raise ImportError(_ERR_MSG.format(name))
ImportError: No module named agepct