如果DEBUG = True,则为Django MemoryError

时间:2017-08-30 09:34:11

标签: django django-settings django-debug-toolbar

当我通过自定义表单向我的应用程序发出查询时出现以下错误:

Environment:


Request Method: GET
Request URL: http://34.212.77.49/anagrafiche/insolventi/?anno=2010

Django Version: 1.11.4
Python Version: 3.5.2
Installed Applications:
['django_jinja',
 'rest_framework',
 'quotemanage',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'debug_toolbar']
Installed Middleware:
['debug_toolbar.middleware.DebugToolbarMiddleware',
 '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',
 'quotemanage.middleware.customMiddleware.NavMenuMiddleware']



Traceback:

File "/var/www/appWSGI/env/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/var/www/appWSGI/env/lib/python3.5/site-packages/django/utils/deprecation.py" in __call__
  142.             response = self.process_response(request, response)

File "/var/www/appWSGI/env/lib/python3.5/site-packages/debug_toolbar/middleware.py" in process_response
  132.                 panel.generate_stats(request, response)

File "/var/www/appWSGI/env/lib/python3.5/site-packages/debug_toolbar/panels/sql/panel.py" in generate_stats
  192.                     query['sql'] = reformat_sql(query['sql'])

File "/var/www/appWSGI/env/lib/python3.5/site-packages/debug_toolbar/panels/sql/utils.py" in reformat_sql
  27.     return swap_fields(''.join(stack.run(sql)))

File "/var/www/appWSGI/env/lib/python3.5/site-packages/sqlparse/engine/filter_stack.py" in run
  34.         for stmt in stream:

File "/var/www/appWSGI/env/lib/python3.5/site-packages/sqlparse/engine/statement_splitter.py" in process
  82.         for ttype, value in stream:

File "/var/www/appWSGI/env/lib/python3.5/site-packages/debug_toolbar/panels/sql/utils.py" in process
  14.         for token_type, value in stream:

File "/var/www/appWSGI/env/lib/python3.5/site-packages/sqlparse/lexer.py" in get_tokens
  60.                 m = rexmatch(text, pos)

Exception Type: MemoryError at /anagrafiche/insolventi/
Exception Value:

我不知道它是否是由我的代码中某处的错误引起的,但是Traceback并没有给我任何想法!

在我的settings.py中,如果设置DEBUG = False,则此错误不再存在。 我不知道该怎么做,我确定需要将我的Debug选项设置为True。

0 个答案:

没有答案