Django错误代码无法弄清楚是什么问题

 布丁宝宝-_932 发布于 2023-01-06 12:43

我得到以下堆栈无法弄清楚问题是什么.我知道它与我的URLS.pi有关我正在尝试做一个美味的馅饼网址来设置Restfull服务

ImportError: importlib._bootstrap is not a frozen module
Traceback (most recent call last):
  File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 339, in urlconf_module
    return self._urlconf_module
AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/base.py", line 101, in get_response
    resolver_match = resolver.resolve(request.path_info)
  File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 318, in resolve
    for pattern in self.url_patterns:
  File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 346, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 341, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/usr/lib/python3.3/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1584, in _gcd_import
  File "", line 1565, in _find_and_load
  File "", line 1532, in _find_and_load_unlocked
  File "", line 584, in _check_name_wrapper
  File "", line 1022, in load_module
  File "", line 1003, in load_module
  File "", line 560, in module_for_loader_wrapper
  File "", line 868, in _load_module
  File "", line 313, in _call_with_frames_removed
  File "/home/Cmaden/cmsite/cmsite/urls.py", line 4, in 
    from myarticle.api import ArticleResource
  File "/home/Cmaden/cmsite/myarticle/api.py", line 1, in 
    from tastypie.resources import ModelResource
  File "/home/Cmaden/.local/lib/python3.3/site-packages/django_tastypie-0.11.1-py3.3.egg/tastypie/resources.py", line 1742, in 
    class BaseModelResource(Resource):
  File "/home/Cmaden/.local/lib/python3.3/site-packages/django_tastypie-0.11.1-py3.3.egg/tastypie/resources.py", line 2212, in BaseModelResource
    @transaction.commit_on_success()
  File "/usr/local/lib/python3.3/dist-packages/django/db/transaction.py", line 448, in commit_on_success
    PendingDeprecationWarning, stacklevel=2)
PendingDeprecationWarning: commit_on_success is deprecated in favor of atomic.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/bin/user_wsgi_wrapper.py", line 67, in __call__
    self.error_log_file.logger.exception("Error running WSGI application")
  File "/usr/lib/python3.3/logging/__init__.py", line 1269, in exception
    self.error(msg, *args, **kwargs)
  File "/usr/lib/python3.3/logging/__init__.py", line 1262, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.3/logging/__init__.py", line 1368, in _log
    self.handle(record)
  File "/usr/lib/python3.3/logging/__init__.py", line 1377, in handle
    if (not self.disabled) and self.filter(record):
  File "/usr/lib/python3.3/logging/__init__.py", line 687, in filter
    for f in self.filters:
  File "/bin/user_wsgi_wrapper.py", line 59, in __call__
    app_iterator = self.app(environ, start_response)
  File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/wsgi.py", line 206, in __call__
    response = self.get_response(request)
  File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/base.py", line 196, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/base.py", line 231, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 69, in technical_500_response
    html = reporter.get_traceback_html()
  File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 323, in get_traceback_html
    c = Context(self.get_traceback_data())
  File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 281, in get_traceback_data
    frames = self.get_traceback_frames()
  File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 428, in get_traceback_frames
    pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name)
  File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 379, in _get_lines_from_file
    source = loader.get_source(module_name)
  File "", line 605, in _requires_frozen_wrapper
ImportError: importlib._bootstrap is not a frozen module
Traceback (most recent call last):
  File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 339, in urlconf_module
    return self._urlconf_module
AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/base.py", line 90, in get_response
    response = middleware_method(request)
  File "/usr/local/lib/python3.3/dist-packages/django/middleware/common.py", line 71, in process_request
    if (not urlresolvers.is_valid_path(request.path_info, urlconf) and
  File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 573, in is_valid_path
    resolve(path, urlconf)
  File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 453, in resolve
    return get_resolver(urlconf).resolve(path)
  File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 318, in resolve
    for pattern in self.url_patterns:
  File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 346, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 341, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/usr/lib/python3.3/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1584, in _gcd_import
  File "", line 1565, in _find_and_load
  File "", line 1532, in _find_and_load_unlocked
  File "", line 584, in _check_name_wrapper
  File "", line 1022, in load_module
  File "", line 1003, in load_module
  File "", line 560, in module_for_loader_wrapper
  File "", line 868, in _load_module
  File "", line 313, in _call_with_frames_removed
  File "/home/Cmaden/cmsite/cmsite/urls.py", line 4, in 
    from myarticle.api import ArticleResource
  File "/home/Cmaden/cmsite/myarticle/api.py", line 1, in 
    from tastypie.resources import ModelResource
  File "/home/Cmaden/.local/lib/python3.3/site-packages/django_tastypie-0.11.1-py3.3.egg/tastypie/resources.py", line 1742, in 
    class BaseModelResource(Resource):
  File "/home/Cmaden/.local/lib/python3.3/site-packages/django_tastypie-0.11.1-py3.3.egg/tastypie/resources.py", line 2212, in BaseModelResource
    @transaction.commit_on_success()
  File "/usr/local/lib/python3.3/dist-packages/django/db/transaction.py", line 448, in commit_on_success
    PendingDeprecationWarning, stacklevel=2)
PendingDeprecationWarning: commit_on_success is deprecated in favor of atomic.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/bin/user_wsgi_wrapper.py", line 67, in __call__
    self.error_log_file.logger.exception("Error running WSGI application")
  File "/usr/lib/python3.3/logging/__init__.py", line 1269, in exception
    self.error(msg, *args, **kwargs)
  File "/usr/lib/python3.3/logging/__init__.py", line 1262, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.3/logging/__init__.py", line 1368, in _log
    self.handle(record)
  File "/usr/lib/python3.3/logging/__init__.py", line 1377, in handle
    if (not self.disabled) and self.filter(record):
  File "/usr/lib/python3.3/logging/__init__.py", line 687, in filter
    for f in self.filters:
  File "/bin/user_wsgi_wrapper.py", line 59, in __call__
    app_iterator = self.app(environ, start_response)
  File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/wsgi.py", line 206, in __call__
    response = self.get_response(request)
  File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/base.py", line 196, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/base.py", line 231, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 69, in technical_500_response
    html = reporter.get_traceback_html()
  File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 323, in get_traceback_html
    c = Context(self.get_traceback_data())
  File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 281, in get_traceback_data
    frames = self.get_traceback_frames()
  File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 428, in get_traceback_frames
    pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name)
  File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 379, in _get_lines_from_file
    source = loader.get_source(module_name)
  File "", line 605, in _requires_frozen_wrapper
ImportError: importlib._bootstrap is not a frozen module

CMP.. 5

问题似乎是通过更改tastypie的文件resources.py文件中的patch_list()方法(第2190行)的装饰器来解决的.

 @transaction.commit_on_success() 

@transaction.atomic()

django/tastypie上的PendingDeprecationWarning

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有