摘要:        
当我们访问一个不存在的属性的时候,会抛出异常,提示我们不存在这个属性。而这个异常就是__getattr__方法抛出的,其原因在于他是访问一个不存在的属性的最后落脚点,作为异常抛出的地方提示出错再适合不过了。 class A(object): def __init__(self, value): se    阅读全文
posted @ 2022-09-29 19:02
Sherwin_szw
阅读(29)
评论(0)
推荐(0)
        
            
        
        
摘要:        
报错 Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. 原因     阅读全文
posted @ 2022-09-29 17:38
Sherwin_szw
阅读(94)
评论(0)
推荐(0)
        
            
        
        
摘要:        
django的request对象 request.method request.GET request.POST request.body request.FILES drf中的request参数,又一层封装 request._request.GET request._request.POST re    阅读全文
posted @ 2022-09-29 16:13
Sherwin_szw
阅读(52)
评论(0)
推荐(0)
        
            
        
        
摘要:        
路由 urlpatterns = [ path('login/', views.LoginView.as_view()), path('login2/', views.login2), ] 视图 from django.views import View from django.http impor    阅读全文
posted @ 2022-09-29 11:39
Sherwin_szw
阅读(21)
评论(0)
推荐(0)
        
            
        
        
摘要:        
安装 pip install djangorestframework 注册 INSTALLED_APPS = [ "rest_framework", ] 配置路由 urlpatterns = [ path('auth/', views.auth), path('login2/', views.log    阅读全文
posted @ 2022-09-29 11:18
Sherwin_szw
阅读(50)
评论(0)
推荐(0)
        
 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号