我是 django 新手,正在尝试学习教程。当我尝试访问 django 管理站点时
http://127.0.0.1:8000/admin/
它为以下代码提供错误“异常值:没有名为 urls 的模块”
#uls.py
from django.conf.urls import *
from mysite.views import *
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
#TODO ADD LIST OF URL
urlpatterns = patterns('',
(r'^home\/?$',get_homepage),
(r'^admin\/?$',include('django.contrib.admin.urls')),
)
我在stackover flow上尝试了多种可用的解决方案@last发布问题得到解决
#settings.py
ROOT_URLCONF = 'mysite.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'mysite.wsgi.application'
TEMPLATE_DIRS = (
'/home/abuzzar/djcode/mysite/mysite/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',
#'django.contrib.staticfiles',
'mysite.jobpost',
'django.contrib.admin',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
错误: http: //pastebin.com/RMvzPd61
我尝试了解决方案:运行测试时 Django 1.5.1 'ImportError: No module named urls'但没有奏效。