我刚开始一个新的Django项目。目前我还没有编写任何代码,只是对设置文件进行了一些调整。我正在使用带有PyDev的eclipse,当我使用eclipse调试应用程序时,每当我尝试访问http://localhost:8000/admin
时,调试器都会捕获VariableDoesNotExist异常。如果我恢复调试器,页面会正确加载。
我已尝试运行./manage.py runserver
,然后页面加载正常。它也在研究heroku。
这是Eclipse调试器停止时的屏幕截图:
我一直在将Eclipse与pyDev一起用于其他Django项目,之前从未遇到过这个问题。
这就是我的settings / base.py的样子:
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'knb9js8(zm#1iu4&m64n249d+i7rk%%1(atevdp&c9fx4u)72*'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS = ('django.contrib.auth.context_processors.auth',
'django.core.context_processors.request',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.tz',
'django.contrib.messages.context_processors.messages')
ROOT_URLCONF = 'pictures.urls'
WSGI_APPLICATION = 'pictures.wsgi.application'
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL = '/static/'
我也尝试使用TEMPLATE_CONTEXT_PROCESSORS
的默认值。
谢谢。
答案 0 :(得分:1)
我如何解决它:
'Ignore ...'
Suspend on django template render exception
,并确保您没有选中列表中的任何复选框。可能只需要2个,但这就是我所做的。