- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我刚刚开始学习 Django 并按照他们的教程进行操作。我已经尝试建立网站三次,每次都遇到相同的错误(在标题中)。
再次,按照他们的官方教程进行操作。我在教程 2,我应该在那里访问管理页面。当我有 DEBUG = False
,我在标题中收到错误消息,这是控制台输出的内容:
deusdies@galaksija:~/Documents/djangosites/testing$ python manage.py runserver
Validating models...
0 errors found
Django version 1.4.3, using settings 'testing.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 153, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 228, in handle_uncaught_exception
return callback(request, **param_dict)
File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py", line 91, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/defaults.py", line 32, in server_error
t = loader.get_template(template_name) # You need to create a 500.html template.
File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", line 145, in get_template
template, origin = find_template(template_name)
File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", line 138, in find_template
raise TemplateDoesNotExist(name)
TemplateDoesNotExist: 500.html
[09/Feb/2013 06:47:23] "GET /admin/ HTTP/1.1" 500 59
DEBUG = False
.与
DEBUG = True
,我得到标准“它有效!”页面,即使我访问/admin/URL,或就此而言页面上的任何其他 URL。
settings.py
:
# Django settings for testing project.
DEBUG = False #I've been playing with this
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('deusdies', 'b@bo.vc'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'baza', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Chicago'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = ''
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'fx$2x-fr0xynw$74j69)tj^(11_xcb7$y2018l+99i3^20wb=!'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'testing.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'testing.wsgi.application'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
'polls',
)
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
最佳答案
在 settings.py 文件中将时区更改为 utc,它对我有用
关于Django - 发生服务器错误。请联系管理员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14788478/
我正在尝试连接到 webapi,该位置在我的 js jquery 文件中看起来像这样。 example.com/?var=input 有没有比 ajax 调用更简单的方法? 最佳答案 我会为此使用 A
我编写了 PHP 代码,它连接到 MYSQL 来查找信息,将其发送到 API,并获取响应以写回到新表中。 有时它工作得很好,有时则不然。如果没有,它会给我这个错误 You have an error
每个子列表都意味着他们是 friend ,现在我想创建一个函数 def is_connected_via_friendships_with 来检查他们是否通过与另一个人的友谊联系在一起。例如,玛丽是卢
我正在尝试将 Cassandra 与 Hector 联系起来: public class Main { public static void main(String[] args) {
我正在使用 mautic API 进行电子邮件列表和电子邮件发送。我正在尝试使用 mautic API auth2.0 获取所有电子邮件列表我正在正确获取访问 token ,但是当我像这样调用电子邮件
我已经与Windows Forms Application进行了简单的聊天。我正在使用套接字,当我尝试连接本地IP时,一切正常,并且可以在本地发送消息。 但是,当我尝试使用外部IP连接到我的 frie
我正在开发我的第一个 GWT 应用程序,它将使用来自 RESTful API 的数据。 我试图找出构建整个应用程序的最佳方法。 GWT 客户端应该与 Java 服务器端联系,然后再联系 API,还是
我对线程中的异常处理有疑问。我有一个简单的 WCF 服务,它需要一些字节作为输入。此 WCF 服务是从控制台应用程序调用的。 方法片段(我的方法) try { _service.ImportBy
我正在尝试编写一个基本的卷应用程序。由于我是用 Ruby 编写的,因此我不想扩展 C 库或使用 ffi ,而是尝试使用 ruby-dbus 编写它,我使用 Address 获得了 /org/pulse
我知道在 CRM 2011 中您无法将联系人转换为潜在客户。在 CRM 2013 中是否可行。 简单来说,我创建了一个联系人并将其分组到一个帐户中。我想将此联系人转换为潜在客户,以便我可以输入销售信息
如何在我的网站页面上添加共享按钮,我们可以使用以下代码在移动 HTML 页面上添加发送短信: title 如何在 Viber、Watsapp 等分享中使用此示例 最佳答案 仅限 HTML 页面。我通常
我想了解 Azure 在门户中创建 Web 应用程序机器人时会做什么。 An Azure Bot Service Bot deployed to an Azure App Service Web Ap
我目前正在构建 Android 4.4。与 seek-for-android在我的 Nexus 5 上获得 UICC 支持。 到目前为止还没有成功。我确实应用了提到的所有补丁 here和 here .
我开发了一个用于农村 Activity 和监控/管理的应用程序。 我的应用程序在白天收集了大量数据,需要将其发送到云端进行处理和分析。在一个正常的 8 小时工作日中,它可以收集多达 2Gb 的数据(大
我编写了一个连接器来从 mysql 获取数据,当 iam 在路由内运行 Mysql 连接器时,它显示错误,并且浏览器正在运行到无限循环。 var express = require('express'
我最近有一个高级主题,mailchimp 的表单看起来非常酷。 我想知道我是否可以将样式用于我的 3 Field Based Contact 表单“REQUEST A CALL BACK”- 名称输入
我正在尝试将基本的 onClick 事件附加到设备中的联系人列表。联系人列表已正确生成。我的代码摘要如下: public class Contacts extends AppCompatActivit
我有一种方法可以根据 Active Directory 验证用户凭据。我想将此方法与 SSL 结合使用,但无法正常工作。 主要问题是我有一个在我们网络之外的服务器(它叫 DMZ 吗?)。从那里我想联系
我正准备在 symfony Doctrine 中开始一个项目,但我必须与多个数据库建立连接。其中之一是无法使用 ORM 映射的现有数据库 (SQL SERVER)。是否有可能将此数据库与另一个未在 D
尝试为 openstack USSURI 版本设置 Controller 节点时。我被要求将 Glance 服务设置为 VM 图像管理子服务。 根据要求:article (在 ubuntu 18.04
我是一名优秀的程序员,十分优秀!