社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  问与答

Django-1.8 Python2.7 写博客出错A server error occurred. Please contact the administrator.

Alan • 9 年前 • 9985 次点击  

http://127.0.0.1:8000/ 页面提示 A server error occurred. Please contact the administrator.

请问哪里出问题了??十分感谢

我的setting.py 的设置

Build paths inside the project like this: os.path.join(BASE_DIR, ...)

import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))

Quick-start development settings - unsuitable for production

See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

SECURITY WARNING: keep the secret key used in production secret!

SECRET_KEY = '474^_i#15!oh9cgrjb&gg&xz1ln6c*v0(n(6)um_k2wfc6w$9s'

SECURITY WARNING: don't run with debug turned on in production!

DEBUG = False

ALLOWED_HOSTS = ['*']

Application definition

INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'blog',

)

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', 'django.middleware.security.SecurityMiddleware',

)

ROOT_URLCONF = 'mysite.urls'

TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ]

WSGI_APPLICATION = 'mysite.wsgi.application'

Database

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

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

Internationalization

https://docs.djangoproject.com/en/1.8/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.8/howto/static-files/

STATIC_URL = '/static/'

template

TEMPLATE_DIRS=( '/home/fnngj/djpy/mysite/blog/templates', )

我的 urls设置 from django.conf.urls import patterns,include, url from django.contrib import admin

urlpatterns = patterns('', # Examples: # url(r'^$', 'mysite.views.home', name='home'),

url(r'^blog/', include('blog.urls')),

url(r'^admin/', include(admin.site.urls)),

)

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/1163
 
9985 次点击  
文章 [ 6 ]  |  最新文章 9 年前