【发布时间】:2014-11-27 21:06:12
【问题描述】:
我刚刚开始了一个新的 Django 项目。目前我还没有编写任何代码,只是对设置文件进行了一些调整。我将 eclipse 与 PyDev 一起使用,当我使用 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 的默认值。
谢谢。
【问题讨论】:
标签: python django eclipse pydev