Python + Django配置后臺管理系統
1. 建立project
django-admin.py startproject newproject
完成上個步驟后,可發現在newproject文件夾下生成了:一個名為newproject的文件夾,一個manage.py文件。
newproject文件夾上又包含了4個文件:
__init__.py
setting.py
urls.py
wsgi.py
至此project建立完畢!
2. 修改文件
#vim urls.py from django.conf.urls.defaults import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'csvt01.views.home', name='home'), # url(r'^csvt01/', include('csvt01.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), ) |
去掉標紅位置的#
#vim setting
INSTALLED_APPS中去掉‘django.contrib.admin’這行的注釋
另外配置數據庫
3.創建數據庫表
#python manage.py syncdb
按提示輸入賬號密碼即可
4.開啟測試服務
#python manage.py runserver
posted on 2014-10-30 11:33 順其自然EVO 閱讀(1160) 評論(0) 編輯 收藏 所屬分類: 測試學習專欄