我第一次使用django-non rel。我已经有了一个简单的django项目。我创建了一个名为job_board的应用程序,并添加到已安装的应用程序元组中。我复制了现有的模型,视图和模板并更新了网址。
在执行manage.py runserver后,我收到错误:
名称'job_board'未定义
INSTALLED_APPS = (
# 'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sessions',
'job_board',
'djangotoolbox',
'autoload',
'dbindexer',
# djangoappengine should come last, so it can override a few manage.py commands
'djangoappengine',
)
urlpatterns = patterns('',
('^_ah/warmup$', 'djangoappengine.views.warmup'),
(r'^$', job_board.views.main_page),
(r'^edit-job/$', job_board.views.edit_job),
(r'^edit-job/(?P<job_id>\d+)$', job_board.views.edit_job),
(r'^job-details/(?P<job_id>\d+)$', job_board.views.job_details),
(r'^edit-location/$', job_board.views.edit_location),
(r'^edit-location/(?P<job_id>\d+)/(?P<location_id>\d+)$', job_board.views.edit_location),
(r'^edit-customer/$', job_board.views.edit_customer),
(r'^edit-customer/(?P<job_id>\d+)/(?P<customer_id>\d+)$', job_board.views.edit_customer),
)
我错过了什么?
答案 0 :(得分:2)
如果您在urls.py中直接使用模块(而不是将其称为字符串),则需要先导入它。