Python Django Gunicorn:调用元类基时出错
我有一个Django应用程序,其中包括一个自定义模型字段(以及附带的表单字段)。当我使用内置的开发服务器运行项目时,它工作得很好。但是,使用gunicorn加载服务器会导致以下错误:Python Django Gunicorn:调用元类基时出错,python,django,metaclass,gunicorn,Python,Django,Metaclass,Gunicorn,我有一个Django应用程序,其中包括一个自定义模型字段(以及附带的表单字段)。当我使用内置的开发服务器运行项目时,它工作得很好。但是,使用gunicorn加载服务器会导致以下错误: TemplateSyntaxError at /admin/ Caught TypeError while rendering: Error when calling the metaclass bases must be type, not None 为了完整起见,我将整个错误包括在下面,它显示了故障线
TemplateSyntaxError at /admin/
Caught TypeError while rendering: Error when calling the metaclass bases
must be type, not None
为了完整起见,我将整个错误包括在下面,它显示了故障线路:
Traceback:
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/contrib/admin/sites.py" in wrapper
214. return self.admin_view(view, cacheable)(*args, **kwargs)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
93. response = view_func(request, *args, **kwargs)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
79. response = view_func(request, *args, **kwargs)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
197. return view(request, *args, **kwargs)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
79. response = view_func(request, *args, **kwargs)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/contrib/admin/sites.py" in index
382. context_instance=context_instance
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/shortcuts/__init__.py" in render_to_response
20. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/loader.py" in render_to_string
188. return t.render(context_instance)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/base.py" in render
123. return self._render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/base.py" in _render
117. return self.nodelist.render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/loader_tags.py" in render
127. return compiled_parent._render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/base.py" in _render
117. return self.nodelist.render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/loader_tags.py" in render
127. return compiled_parent._render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/base.py" in _render
117. return self.nodelist.render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/defaulttags.py" in render
311. return self.nodelist_true.render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/defaulttags.py" in render
311. return self.nodelist_true.render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/loader_tags.py" in render
64. result = block.nodelist.render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/template/defaulttags.py" in render
437. url = reverse(view_name, args=args, kwargs=kwargs, current_app=context.current_app)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/core/urlresolvers.py" in reverse
391. *args, **kwargs)))
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/core/urlresolvers.py" in reverse
312. possibilities = self.reverse_dict.getlist(lookup_view)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/core/urlresolvers.py" in _get_reverse_dict
229. self._populate()
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/core/urlresolvers.py" in _populate
208. for name in pattern.reverse_dict:
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/core/urlresolvers.py" in _get_reverse_dict
229. self._populate()
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/core/urlresolvers.py" in _populate
208. for name in pattern.reverse_dict:
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/core/urlresolvers.py" in _get_reverse_dict
229. self._populate()
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/core/urlresolvers.py" in _populate
197. for pattern in reversed(self.url_patterns):
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/core/urlresolvers.py" in _get_url_patterns
279. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/core/urlresolvers.py" in _get_urlconf_module
274. self._urlconf_module = import_module(self.urlconf_name)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/utils/importlib.py" in import_module
35. __import__(name)
File "/home/rob/projects/shipp/shipp/tickets/urls.py" in <module>
3. from shipp.tickets.views import TicketListView, TicketDetailView, \
File "/home/rob/projects/shipp/shipp/tickets/views.py" in <module>
15. from shipp.tickets.forms import TicketForm, TicketAttributesForm, \
File "/home/rob/projects/shipp/shipp/tickets/forms.py" in <module>
26. class TicketTimeSpentForm(forms.ModelForm):
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/forms/models.py" in __new__
205. opts.exclude, opts.widgets, formfield_callback)
File "/home/rob/.virtualenvs/shipp/lib/python2.7/site-packages/django/forms/models.py" in fields_for_model
159. formfield = f.formfield(**kwargs)
File "/home/rob/projects/shipp/shipp/../shipp/tickets/fields.py" in formfield
43. return super(TimedeltaField, self).formfield(*args, **defaults)
Exception Type: TemplateSyntaxError at /admin/
Exception Value: Caught TypeError while rendering: Error when calling the metaclass bases
must be type, not None
回溯:
get_响应中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/core/handlers/base.py”
111响应=回调(请求,*回调参数,**回调参数)
包装器中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/contrib/admin/sites.py”
214返回self.admin_视图(视图,可缓存)(*args,**kwargs)
视图中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/utils/decorators.py”
93响应=查看功能(请求,*args,**kwargs)
文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/views/decorators/cache.py”位于包装视图功能中
79响应=查看功能(请求,*args,**kwargs)
文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/contrib/admin/sites.py”
197返回视图(请求、*args、**kwargs)
文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/views/decorators/cache.py”位于包装视图功能中
79响应=查看功能(请求,*args,**kwargs)
索引中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/contrib/admin/sites.py”
382context\u实例=context\u实例
render\u to\u响应中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/shortcuts/\uuuuu init\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
20返回HttpResponse(loader.render_to_string(*args,**kwargs),**HttpResponse_kwargs)
render_to_字符串中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/loader.py”
188返回t.render(上下文\实例)
render中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/base.py”
123返回self.\u呈现(上下文)
文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/base.py”位于_render中
117返回self.nodelist.render(上下文)
render中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/base.py”
744bits.append(self.render_节点(节点,上下文))
render_节点中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/debug.py”
73结果=node.render(上下文)
render中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/loader_tags.py”
127返回编译的\u父对象。\u呈现(上下文)
文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/base.py”位于_render中
117返回self.nodelist.render(上下文)
render中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/base.py”
744bits.append(self.render_节点(节点,上下文))
render_节点中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/debug.py”
73结果=node.render(上下文)
render中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/loader_tags.py”
127返回编译的\u父对象。\u呈现(上下文)
文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/base.py”位于_render中
117返回self.nodelist.render(上下文)
render中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/base.py”
744bits.append(self.render_节点(节点,上下文))
render_节点中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/debug.py”
73结果=node.render(上下文)
render中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/defaulttags.py”
311返回self.nodelist\u true.render(上下文)
render中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/base.py”
744bits.append(self.render_节点(节点,上下文))
render_节点中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/debug.py”
73结果=node.render(上下文)
render中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/defaulttags.py”
311返回self.nodelist\u true.render(上下文)
render中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/base.py”
744bits.append(self.render_节点(节点,上下文))
render_节点中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/debug.py”
73结果=node.render(上下文)
render中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/loader_tags.py”
64结果=block.nodelist.render(上下文)
render中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/base.py”
744bits.append(self.render_节点(节点,上下文))
render_节点中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/debug.py”
73结果=node.render(上下文)
render中的文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/template/defaulttags.py”
437url=reverse(查看\名称,args=args,kwargs=kwargs,当前\应用程序=上下文。当前\应用程序)
文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/core/urlresolvers.py”的格式相反
391. *args,**kwargs)))
文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/core/urlresolvers.py”的格式相反
312可能性=self.reverse\u dict.getlist(查找视图)
文件“/home/rob/.virtualenvs/shipp/lib/python2.7/site packages/django/core/urlresolvers.py”位于
229