在升级了我的一个包(django注册)之后,我在尝试运行python manage.py runserver
时收到了这个错误
输出如下所示。在
我以为
python3.5/site-packages/confusable_homoglyphs/categories.py
可能丢失了,我重新安装了包confusable_homoglyphs
,但没有用。它引发了相同的错误
在那之后
在我的项目文件夹中创建了一个文件名=3.0.0.txt
,它写在下面
Requirement already satisfied: confusable_homoglyphs in ./myvenv/lib/python3.5/site-packages
我试图删除包并添加该包(甚至在虚拟环境之外的n内)。但它抛出了与下面相同的错误。在
(myvenv) shubhendu@shubhendu-HP-Pavilion-g6-Notebook-PC:/home/foodballbear$ python manage.py runserver
Performing system checks...
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f320538d400>
Traceback (most recent call last):
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/confusable_homoglyphs/categories.py", line 141, in <module>
categories_data = load('categories.json')
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/confusable_homoglyphs/utils.py", line 33, in load
with open('{}/{}'.format(os.getcwd(), filename), 'r') as file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/foodballbear/categories.json'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/confusable_homoglyphs/categories.py", line 144, in <module>
if generate():
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/confusable_homoglyphs/categories.py", line 111, in generate
file = get(url)
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/confusable_homoglyphs/utils.py", line 24, in get
return urlopen(url).read().decode('utf-8').split('\n')
File "/usr/lib/python3.5/http/client.py", line 461, in read
s = self._safe_read(self.length)
File "/usr/lib/python3.5/http/client.py", line 607, in _safe_read
chunk = self.fp.read(min(amt, MAXAMOUNT))
File "/usr/lib/python3.5/socket.py", line 575, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
self.check(display_num_errors=True)
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/django/urls/resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/django/urls/resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/foodballbear/myfoodsite/urls.py", line 27, in <module>
url(r'^accounts/', include('registration.backends.simple.urls')),
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/django/conf/urls/__init__.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/registration/backends/simple/urls.py", line 10, in <module>
from . import views
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/registration/backends/simple/views.py", line 10, in <module>
from registration.views import RegistrationView as BaseRegistrationView
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/registration/views.py", line 12, in <module>
from registration.forms import RegistrationForm
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/registration/forms.py", line 19, in <module>
from . import validators
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/registration/validators.py", line 10, in <module>
from confusable_homoglyphs import confusables
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/confusable_homoglyphs/confusables.py", line 7, in <module>
from .categories import unique_aliases, alias
File "/home/foodballbear/myvenv/lib/python3.5/site-packages/confusable_homoglyphs/categories.py", line 147, in <module>
raise Exception('Datafile not found, datafile generation failed!')
Exception: Datafile not found, datafile generation failed!
您正试图访问
categories.json
在django中无法直接访问该文件。因此发生了异常。在使用以下解决方案访问
categories.json
BASE_DIR
为您提供项目目录路径,然后您希望使用os.path.join()
加入文件路径希望这对你有帮助
这个问题以前也有人提过
https://github.com/vhf/confusable_homoglyphs/issues/7
我现在可以通过管理.py,包似乎有问题
每次加载时它都会下载文件。当依赖项经常被下载时,它会导致
多亏了comment中提供的链接,该修补程序已被应用并将与
confusable_homoglyphs>=3.0.0.
配合使用运行带有选项no site packages的virtualenv将不包括全局安装的包。它可能有助于保持包列表的整洁,以防以后需要访问它
为了保持环境的一致性,我“冻结”环境包的当前状态
这是我的要求.txt在
^{pr2}$这是我的要求.txt在我加上`
`所需版本
然后我运行
pip install -r requirements.txt
在那之后,我的
python manage.py runserver
没有抛出任何错误相关问题 更多 >
编程相关推荐