2013-05-21 34 views
0

我正在设置一个django项目(第一次)。django settings.py值错误

我试图配置,但尽管它显示了一些值的错误。

这里是settings.py

settings.py

DEBUG = True 
TEMPLATE_DEBUG = DEBUG 

ADMINS = (
    ('asit', '[email protected]'), 
) 

MANAGERS = ADMINS 

DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 
     'NAME': 'C:\\Users\\asit\\workspace\\tutu\\src\\sqlite.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. 
    } 
} 

TIME_ZONE = 'America/Chicago' 

SITE_ID = 1 

USE_I18N = True 

USE_L10N = True 

MEDIA_ROOT = 'C:\\django\\media' 

MEDIA_URL = '' 

ADMIN_MEDIA_PREFIX = '/media/' 

SECRET_KEY = 'secret_key' 

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

ROOT_URLCONF = '' 

TEMPLATE_DIRS = (
    'C:\\django\\template\\' 
    # 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', 
    # Uncomment the next line to enable the admin: 
    'django.contrib.admin', 
    # Uncomment the next line to enable admin documentation: 
    # 'django.contrib.admindocs', 
) 

urls.py

from django.conf.urls.defaults import * 

# Uncomment the next two lines to enable the admin: 
from django.contrib import admin 
admin.autodiscover() 

urlpatterns = patterns('', 
    # Example: 
    # (r'^tutu/', include('tutu.foo.urls')), 

    # Uncomment the admin/doc line below to enable admin documentation: 
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')), 

    # Uncomment the next line to enable the admin: 
    (r'^admin/', include(admin.site.urls)), 
) 

的错误是

Exception Type:  ValueError 
Exception Value:  

Empty module name 

Exception Location:  C:\Python27\lib\site-packages\django\utils\importlib.py in import_module, line 35 

有人可以帮我吗?

+1

你什么时候得到错误? –

+0

我得到了url http:// localhost:8000/admin的错误。 –

+0

设置看起来不错,粘贴的意见/ URL可能会有所帮助。 – yuwang

回答

1

原因是你有空ROOT_URLCONF。它没有定义任何默认值,所以您应该在这里为您的项目提供实际的url配置。最有可能它只是yourprojectname.urls,这样

ROOT_URLCONF = 'yourprojectname.urls' 

见的Django URLDispacther docs了解详情。

+0

它的工作...我初始化'tutu.urls' –