1.ORM1.1.创建类和字段classUserInfo(models.Model):name=models.CharField(max_length=64)age=models.IntergerField()pythonmanage.pymakemigrationspythonmanage.pymigrate#setting.py中INSTALLED_APPS添加app1.2.增models.U
1.Django请求的生命周期路由系统url,视图函数(获取模板+数据),返回字符串2.路由系统/index//detail/(\d+)/detail/(?p<nid>\d+)/detail/name=’a1‘视图中:reverse;模板中:{%url“a1”%}路由分发include(’app01.urls‘)3.视图FBV:函数defindex(request,*args,**kw
1.安装djangopipinstalldjango2.创建django工程django-adminstartproject工程名3.创建APPpythonmanage.pystartappcmdb4.project.settings.py配置静态文件css/js最后面添加STATICFILES_DIRS=(os.path.join(BASE_DIR,'static'),)5.模板路径[os.pa
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号