Closed ghost closed 5 years ago
大兄弟,图片上传失败了,重新发个图片。
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/django_celery_beat/periodictask/
Django Version: 2.2.2
Python Version: 3.6.8
Installed Applications:
['simpleui',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_celery_beat',
'django_celery_results',
'rest_framework',
'rest_framework_swagger']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Template error:
In template /Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/simpleui/templates/admin/actions.html, error at line 106
Object of type '__proxy__' is not JSON serializable
96 : }, {
97 : value: 5,
98 : label: 'json'
99 : }, {
100 : value: 6,
101 : label: 'yaml'
102 : }, {
103 : value: 7,
104 : label: 'html'
105 : }],
106 : customButton:{% autoescape off %} {% custom_button %} {% endautoescape %},
107 : exts:[]
108 : },
109 : methods: {
110 : getIcon:getIcon,
111 : extClick:function(item){
112 : window.location.href=item.url;
113 : },
114 : formSubmit: function () {
115 : $("#changelist-form").submit();
116 : },
Traceback:
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
145. response = self.process_exception_by_middleware(e, request)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
143. response = response.render()
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/response.py" in render
106. self.content = self.rendered_content
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/response.py" in rendered_content
83. content = template.render(context, self._request)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/backends/django.py" in render
61. return self.template.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render
171. return self._render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in _render
163. return self.nodelist.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render_annotated
904. return self.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/loader_tags.py" in render
150. return compiled_parent._render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in _render
163. return self.nodelist.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render_annotated
904. return self.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/loader_tags.py" in render
150. return compiled_parent._render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in _render
163. return self.nodelist.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render_annotated
904. return self.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/defaulttags.py" in render
309. return nodelist.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render_annotated
904. return self.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/loader_tags.py" in render
62. result = block.nodelist.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render_annotated
904. return self.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/loader_tags.py" in render
62. result = block.nodelist.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render_annotated
904. return self.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/contrib/admin/templatetags/base.py" in render
33. return super().render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/library.py" in render
234. return t.render(new_context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render
173. return self._render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in _render
163. return self.nodelist.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render_annotated
904. return self.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/defaulttags.py" in render
37. output = self.nodelist.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/base.py" in render_annotated
904. return self.render(context)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/django/template/library.py" in render
192. output = self.func(*resolved_args, **resolved_kwargs)
File "/Users/zhangjp/PycharmProjects/cb/venv/lib/python3.6/site-packages/simpleui/templatetags/simpletags.py" in custom_button
350. return json.dumps(data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py" in dumps
231. return _default_encoder.encode(obj)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/encoder.py" in encode
199. chunks = self.iterencode(o, _one_shot=True)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/encoder.py" in iterencode
257. return _iterencode(o, 0)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/encoder.py" in default
180. o.__class__.__name__)
Exception Type: TypeError at /admin/django_celery_beat/periodictask/
Exception Value: Object of type '__proxy__' is not JSON serializable
@benma9 simpleui是什么版本的?
@ClassmateLin 今天pip安装的 Django==2.2.2 django-celery-beat==1.5.0 django-celery-results==1.1.2 django-restframework==0.0.1 django-simpleui==2.1.3
2.1.4中已经修复,请升级
pip install django-simpleui -U
![Uploading image.png…]()
https://csds.nkhdkj.com/admin/djcelery/periodictask/ 2.1.8 TypeError Object of type 'proxy' is not JSON serializable