1. 更改settings.py
共要改三個地方
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'c:/django_www/data.db'
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
)
DATABASE_NAME = 'c:/django_www/data.db'
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
)
2. 配置sqlite3與data.db
打開DOS Prompt,下達
manage.py syncdb
然後照著上面的提示輸入
3. 更改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'^www/', include('www.foo.urls')),
# (r'^$', 'www.helloworld.index'),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/(.*)', admin.site.root),
)
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^www/', include('www.foo.urls')),
# (r'^$', 'www.helloworld.index'),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/(.*)', admin.site.root),
)
然後就可以到http://localhost/admin/看看admin頁面了!
沒有留言:
張貼留言