Import Error: No module named settings in Django
Import Error: No module named settings in Django
我继续 http://kw20kb.wikidot.com/geodjango。我在我的项目文件夹中创建了一个 urls.py 并在其中添加了以下行。
from django.conf.urls import patterns, include, url
from django.contrib import admin
import settings
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
url(r'', include('waypoints.urls')),
)
当我 运行 我的开发服务器出现错误
Import Error: No module named settings
导致此错误的原因是什么?
改为使用:
from django.conf import settings
可以在文档中找到有关使用 django settings 的更多信息。
我继续 http://kw20kb.wikidot.com/geodjango。我在我的项目文件夹中创建了一个 urls.py 并在其中添加了以下行。
from django.conf.urls import patterns, include, url
from django.contrib import admin
import settings
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
url(r'', include('waypoints.urls')),
)
当我 运行 我的开发服务器出现错误
Import Error: No module named settings
导致此错误的原因是什么?
改为使用:
from django.conf import settings
可以在文档中找到有关使用 django settings 的更多信息。