| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2036 人关注过本帖
标题:setting 设置了总是报错
只看楼主 加入收藏
cai410579517
Rank: 3Rank: 3
来 自:宁德
等 级:论坛游侠
威 望:6
帖 子:128
专家分:179
注 册:2013-8-18
结帖率:88%
收藏
 问题点数:0 回复次数:1 
setting 设置了总是报错
错误显示:
图片附件: 游客没有浏览图片的权限,请 登录注册


setting代码配置
"""
# 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.
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '^_5!#_w(@h#3*f2q(p8c6p)sd0et6@_hx!8*%tdzjbaqfx&h^8'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
ROOT_DIR = ''
ROOT_DIR = os.path.dirname(os.path.dirname(__file__))
# Application definition
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#   'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# List of callables that know how to import templates from various sources.
INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'bgstage',
)
MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.',
  # 'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',

)
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#    'django.template.loaders.eggs.Loader',
)
STATIC_ROOT = ''
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
TEMPLATES_DIR = (
    os.path.join(ROOT_DIR, '../templates').replace('\\','/'),
    # 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.
)
ROOT_URLCONF = 'setting.urls'
WSGI_APPLICATION = 'setting.wsgi.application'
# Database
# https://docs.
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}
# Internationalization
# https://docs.
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.
STATIC_URL = '/static/'

view.py从这里开始
from django.shortcuts import render_to_response
from setting import settings
from django.http import HttpResponse  
from django.http import HttpResponseRedirect
from django.contrib.auth.views import logout
from django.contrib.auth.decorators import login_required
# from common import remote_data
# from common.ajax import standardAjax
# from common.view_common import *
from django.contrib.auth.views import logout
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
import random
import time
 
def statrtpro(request):
    return HttpResponse("Hello NowaMagic!")

def index(request):
  ROOT_DIR = os.path.dirname(os.path.dirname(__file__))
  paths=os.path.join(ROOT_DIR).replace('\\','/')
  print paths,'aaas'
  print sys.path.append(paths)
  return render_to_response(
  'index.html',
  {},
  context_instance=RequestContext(request))
搜索更多相关主题的帖子: settings secret import file 
2014-05-21 15:36
cai410579517
Rank: 3Rank: 3
来 自:宁德
等 级:论坛游侠
威 望:6
帖 子:128
专家分:179
注 册:2013-8-18
收藏
得分:0 
版主我需要帮助 给点说明吧  为什么会这样
2014-05-30 14:32
快速回复:setting 设置了总是报错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033090 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved