Django管理员给出内部服务器错误500

Django管理员给出内部服务器错误500,django,django-admin,Django,Django Admin,我的django和python知识不是很深。我遵循Django教程(1.7),然后创建了一个应用程序,供某人通过Django管理员更新人员列表。我让它在本地工作,在我的登台服务器上也能工作 在生产中,该网站的工作,我可以进入管理员登录页面。但是当我登录时,我得到一个500的内部服务器错误。我花了大约两天的时间调试这个 Apache错误日志显示“[Errno 111]连接被拒绝”,但大量的谷歌搜索显示,该文本没有任何我可以使用的内容 根据我在这里找到的一些相关对话,他们似乎专注于使用django发

我的django和python知识不是很深。我遵循Django教程(1.7),然后创建了一个应用程序,供某人通过Django管理员更新人员列表。我让它在本地工作,在我的登台服务器上也能工作

在生产中,该网站的工作,我可以进入管理员登录页面。但是当我登录时,我得到一个500的内部服务器错误。我花了大约两天的时间调试这个

Apache错误日志显示“[Errno 111]连接被拒绝”,但大量的谷歌搜索显示,该文本没有任何我可以使用的内容

根据我在这里找到的一些相关对话,他们似乎专注于使用django发送电子邮件(我不是)

我想我已经正确配置了允许的主机,因为我可以看到非管理员站点

我比较了登台服务器和生产服务器之间的apache配置和文件权限,它们似乎都是相同的

如果您能提供任何帮助,我们将不胜感激。多谢各位

错误。日志

[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664] mod_wsgi (pid=26646): Exception occurred processing WSGI script '/home/admin/dj-1.7/accountedge/trunk/accountedge/accountedge/wsgi.py'., referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664] Traceback (most recent call last):, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/home/admin/dj-1.7/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 187, in __call__, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     response = self.get_response(request), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/home/admin/dj-1.7/lib/python2.7/site-packages/django/core/handlers/base.py", line 199, in get_response, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     response = self.handle_uncaught_exception(request, resolver, sys.exc_info()), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/home/admin/dj-1.7/lib/python2.7/site-packages/django/core/handlers/base.py", line 231, in handle_uncaught_exception, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     'request': request, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/usr/lib/python2.7/logging/__init__.py", line 1178, in error, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     self._log(ERROR, msg, args, **kwargs), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/usr/lib/python2.7/logging/__init__.py", line 1271, in _log, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     self.handle(record), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/usr/lib/python2.7/logging/__init__.py", line 1281, in handle, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     self.callHandlers(record), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/usr/lib/python2.7/logging/__init__.py", line 1321, in callHandlers, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     hdlr.handle(record), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/usr/lib/python2.7/logging/__init__.py", line 749, in handle, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     self.emit(record), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/home/admin/dj-1.7/lib/python2.7/site-packages/django/utils/log.py", line 132, in emit, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     connection=self.connection()), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/home/admin/dj-1.7/lib/python2.7/site-packages/django/core/mail/__init__.py", line 98, in mail_admins, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     mail.send(fail_silently=fail_silently), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/home/admin/dj-1.7/lib/python2.7/site-packages/django/core/mail/message.py", line 286, in send, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     return self.get_connection(fail_silently).send_messages([self]), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/home/admin/dj-1.7/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 92, in send_messages, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     new_conn_created = self.open(), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/home/admin/dj-1.7/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 50, in open, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     self.connection = connection_class(self.host, self.port, **connection_params), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/usr/lib/python2.7/smtplib.py", line 251, in __init__, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     (code, msg) = self.connect(host, port), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/usr/lib/python2.7/smtplib.py", line 311, in connect, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     self.sock = self._get_socket(host, port, self.timeout), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/usr/lib/python2.7/smtplib.py", line 286, in _get_socket, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     return socket.create_connection((host, port), timeout), referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]   File "/usr/lib/python2.7/socket.py", line 571, in create_connection, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664]     raise err, referer: ***.com/admin/login/?next=/admin/
[wsgi:error] [pid 26646:tid 140557972109056] [client xx.xx.xxx.xx:57664] error: [Errno 111] Connection refused, referer: ***.com/admin/login/?next=/admin/
设置.py

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from os import path
import socket
from os.path import dirname
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
ROOT_PATH = os.path.dirname(__file__)
PROJECT_ROOT = os.path.dirname(os.path.abspath(__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 = 'x'

# SECURITY WARNING: don't run with debug turned on in production!
if socket.gethostname().startswith('x'):
    DEBUG = TEMPLATE_DEBUG = True
else:
    DEBUG = TEMPLATE_DEBUG = False

ALLOWED_HOSTS = [
    '.accountedge.com',
    'accountedge.com',
    'localhost',
    '162.209.1.124',
    '162.209.4.135',
]


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'geoip',
    'localflavor',
    'partners',
)

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',
)

ROOT_URLCONF = 'accountedge.urls'

WSGI_APPLICATION = 'accountedge.wsgi.application'

TEMPLATE_DIRS = (
    os.path.join(BASE_DIR, 'accountedge/templates'),
)

# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

ADMINS = (
    ('ed', 'x'),
)

# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'America/New_York'

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/'

STATIC_ROOT = path.join(PROJECT_ROOT, 'static-root/')

## local
if socket.gethostname().startswith('x'):
    STATIC_URL = '/static/'
## staging: rackspace
elif socket.gethostname() == 'rerun-mktg':
    STATIC_URL = 'http://x/accountedge/staging/rackspace/static/'
## PRODUCTION
else:
    STATIC_URL = 'http://x/accountedge/static/'

# Additional locations of static files
STATICFILES_DIRS = (
    ('', path.join(PROJECT_ROOT,'static')),
)

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth',
    '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',
    'geoip.context.maxmind',
)

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.load_template_source',
)

看起来您正在某处使用
send\u mail()
,但尚未为mail指定任何设置。您可以查看更多详细信息。

虽然我没有在任何地方使用send_mail(),但我还是按照您的建议添加了一个电子邮件后端。然后,当我再次尝试时,我收到一封电子邮件,跟踪告诉我:
操作错误:尝试编写一个只读数据库,这就解决了问题。谢谢你的帮助!