收集魔法。

codebehind的Python项目详细描述


https://travis-ci.org/michaelhenry/codebehind.svg?branch=masterhttps://img.shields.io/pypi/v/codebehind.svghttps://img.shields.io/badge/contact-@michaelhenry119-blue.svg?style=flat

因为我不想再做同样的事情了。如果您使用的是django rest框架,那么这可能会对您有所帮助。

功能

  • 注册和登录
  • 不同的身份验证逻辑(基本、令牌、hmac签名)
  • 基本助手
  • 因为它使用drf,可浏览rest api!

快速启动

  1. 将“代码隐藏”添加到已安装的应用程序设置中,如下所示:

    INSTALLED_APPS = [
        ...
        'codebehind',
        'rest_framework',
    ]
    
  2. 运行python manage.py migrate以创建有用的模型。

  3. 在您的*设置中。

    REST_FRAMEWORK = {
        # Use Django's standard `django.contrib.auth` permissions,
        # or allow read-only access for unauthenticated users.
        'DEFAULT_PERMISSION_CLASSES': (
                'rest_framework.permissions.IsAdminUser',
                'rest_framework.permissions.IsAuthenticated',
        ),
    
        'DEFAULT_AUTHENTICATION_CLASSES': (
           'codebehind.authentication.CodeBehindAuthentication',
           'rest_framework.authentication.BasicAuthentication',
           'rest_framework.authentication.SessionAuthentication',
        ),
    
        'PAGE_SIZE': 20
    }
    
  4. urls.py中:

    from rest_framework import routers
    from django.conf.urls import include, url
    from codebehind.views import UsersViewSet, GroupViewSet
    
    router = routers.DefaultRouter()
    router.register(r'users', UsersViewSet,'users')
    router.register(r'groups', GroupViewSet,'groups')
    
    urlpatterns += [
        # add this
        url(r'^v1/', include(router.urls)),
    ]
    

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
CentOS上的java Spring Boot简易应用程序需要很长时间才能启动   java如何检查字符串值是否等于null?   收集器中的java映射值。分组方式()   java需要支持Azure AD B2C webapp集成   java如何加入线程以停止它?   java如何使用意图传递类的对象?   java如何在战争环境中发现CDI生产者?   多模块项目中java奇怪的编译器行为   java如何在web应用程序中管理密码?   java从http服务器、filehandler中删除冗余代码   java使用反射来获取泛型类的字段   java Spring MVC/Hibernate/MySQL 400错误请求错误   给定正整数a的java幂为3   在Java中将元素拆分为不同数量的列表?   java展开折叠窗格