- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在这里阅读了很多答案,但没有一个回答我的确切问题。
我做了第一部分,民意调查。我开始了第 2 部分,管理员,但是,在 runserve 之后,当我尝试访问该页面时,这是我得到的错误(我的项目名称是 john):
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/
Using the URLconf defined in john.urls, Django tried these URL patterns, in this order:
^admin/
The current URL, , didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. ``
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'newgrid.views.home', name='home'),
# url(r'^newgrid/', include('newgrid.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)
from django.db import models
import datetime
from django.utils import timezone
# Create your models here.
from django.db import models
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_recently(self):
return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __unicode__(self):
return self.choice
# Django settings for newgrid project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'C:/john/john/johny.db', # 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 = 'cl8%_lzxbct-^ebmpje25%r&5*0=$qmv9gw6i$^arox*kr4$_e'
# 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 = 'newgrid.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'newgrid.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,
},
}
}
最佳答案
您导航到错误的 URL。作为 the tutorial says ,
Now, open a Web browser and go to
/admin/
on your local domain — e.g.,http://127.0.0.1:8000/admin/
. You should see the admin's login screen:
关于django - 新手。 Django 教程(来自 django 网站)停留在第 2 部分 - 管理员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11909710/
我是 Xcode 4.4 和 AppleScriptObjC 世界的新手。我正在尝试扩展和试验 Sanderson 和 Rosenthal 所著的“学习 AppleScript”一书中关于 Apple
我完全迷失在 shell 编程中,主要是因为我使用的每个站点都提供不同的工具来进行模式匹配。所以我的问题是使用什么工具在管道流中进行简单的模式匹配。 上下文:我有named.conf 文件,我需要一个
我对 C 很陌生,我一直在尝试用这种数据结构制作一个程序: struct node { char command[100]; char prereq[100][80]; cha
该程序检查用户输入的数字是否为素数。 我的问题在if语句中。由于某些原因,Boolean永远不会切换。如果数字为质数,则只会给出两个结果。 我想念什么? import java.util.Scanne
我只是在学习 Haskell。我认为这会产生一个阶乘函数...... (在 ghci 内) Prelude> let ft 0 = 1 Prelude> let ft n = n * ft (n -
这个问题已经有答案了: Using bitwise OR 0 to floor a number (7 个回答) 已关闭 6 年前。 我试图在 JavaScript 中使用二分搜索来查找数组元素,并且
使用 Signal R,如果尝试发送对象,传递模型的语法是什么? private async void FormLoaded(object sender, RoutedEventArgs e) {
我需要使用 Javascript 生成一个半金字塔数字系列,其中包含输入的起始数字和 html 页面中的行数,并在 html 页面中显示结果。我已经完成了 Java 脚本编写之类的工作。我不明白的是它
为什么函数名重复 示例: lucky :: (Integral a) => a -> String lucky 7 = "LUCKY NUMBER SEVEN!" lucky x = "Sorry
我花了2天的时间在GGTS中使用grails进行Web开发。我正在跟着一本书。本书使用命令行。到目前为止,这很棒,但是现在这本书正在使用webtest。我已经在命令行上安装了webtest,但是如何在
我正在学习 Clojure,到目前为止我无法理解这个小难题,我确信这是非常基本的。 我有这个文件: (ns cloapp.core (:gen-class)) (defn -main "I d
我在获取图像以显示在我的 J Frame 中时遇到问题。我确信我将文件放在正确的位置并且输入了正确的名称。这是代码 import java.awt.Color; import java.awt.Gra
我正在尝试为我正在做的应用程序创建一个登录窗口。我整天都在寻找一个例子,但我似乎找不到任何有帮助的东西。我的基本结构如下: // App.scala object App extends Simple
坦率地说,我是 Java 新手。我正在开发一个项目,我想找到一种基于数字序列创建多项式函数的方法。 无论如何,我的问题是我创建了一个存储序列的数组。我现在想找出元素之间的差异。例如。我想找到这个计算a
现在添加了 xml 和 logcat,现在自定义 View 代码,不幸的是我远离开发计算机所以我无法检查你的建议,@jems,我的自定义 View 的构造函数可能错误?@Falmarri,我认为构建目
我在这里缺少什么?当我单击“h2 a”链接时,.content ol 应该切换。我不明白为什么它不起作用:( $(document).ready(function(){ $(".content ol
我是 Java 新手,我到处寻找,但我没有得到一个简单的概念。 我将两个变量声明为 int。我希望这两个变量对于所有方法都是全局的。在我的第一个方法中,我想从用户输入中获取第一个变量的值。然后我希望第
我正在抓取 IMDB 页面的数据,但当尝试将其写入 CSV 文件时,我只从结果中获取最后一行。 代码下方: from urllib.request import urlopen as uReq fro
自从我学习 C 语言以来,我决定制作一个简单的程序,用于加、减和计算两个变量的乘积。根据用户的输入是1,2还是3来选择加/减/折叠。 #include int main (void) { in
int main(void) { string n = GetString(); if(n!=NULL){ for(int i=0, j=strlen(n); i
我是一名优秀的程序员,十分优秀!