E:\WWWROOT\python\mysite>python manage.py createsuperuser System check identified some issues:
WARNINGS: ?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DIRS. Username (leave blank to use 'administrator'): root Email address: admin@admin.com Password: Password (again): Superuser created successfully.
# Create your views here. from blog import models #导入blog模块 from django.shortcuts import HttpResponse defdb_handle(request): models.UserInfo.objects.create(username='andy',password='123456',age=33) return HttpResponse('OK')
下面我们配置路由,以便让浏览器能够访问到views.py文件:
1 2 3 4 5 6 7 8
from django.conf.urls import url from django.contrib import admin
from blog import views urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^db_handle', views.db_handle), ]