[英]Django error code can't figure out what issue is
I am getting the following stack can not figure out what the issue is. 我得到以下堆栈无法弄清楚问题是什么。 I know its to do with my URLS.pi i am trying to do a tasty pie url to setup a Restfull Service 我知道它与我的URLS.pi有关,我正在尝试创建一个可口的Pie URL来设置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 "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 868, in _load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/home/Cmaden/cmsite/cmsite/urls.py", line 4, in <module>
from myarticle.api import ArticleResource
File "/home/Cmaden/cmsite/myarticle/api.py", line 1, in <module>
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 <module>
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 "<frozen importlib._bootstrap>", 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 "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 868, in _load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/home/Cmaden/cmsite/cmsite/urls.py", line 4, in <module>
from myarticle.api import ArticleResource
File "/home/Cmaden/cmsite/myarticle/api.py", line 1, in <module>
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 <module>
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 "<frozen importlib._bootstrap>", line 605, in _requires_frozen_wrapper
ImportError: importlib._bootstrap is not a frozen module
Problem seems to be solved by changing the decorator of patch_list() method (line 2190) in file resources.py file of tastypie from 问题似乎是通过更改来自以下位置的Deliciouspie文件的resources.py文件中的patch_list()方法的装饰器(第2190行)来解决的
@transaction.commit_on_success()
to 至
@transaction.atomic()
PendingDeprecationWarning on django / tastypie 待定django / tastypie上的警告
should not tasypie developers change it as mentioned above ? Tasypie开发人员是否应该如上所述更改它? I have just had this exact problem and followed your advice: change decorator @transaction.commit_on_success() to @transaction.atomic and it helped. 我刚刚遇到了这个确切的问题,并按照您的建议进行了操作:将装饰器@ transaction.commit_on_success()更改为@ transaction.atomic,它有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.