新增组件

使用 python manage.py startapp新建一个app,并且在settings中注册,添加stark.apps.StarkConfig,

然后在stark的apps中添加ready()方法,

from django.apps import AppConfig
from django.utils.module_loading import autodiscover_modules


class StarkConfig(AppConfig):
    name = 'stark'

    def ready(self):
        autodiscover_modules('stark')
View Code

当忘记了如何引用,查看admin的源码即可知道

在写装饰器的时候如何保留原函数的信息

 

posted on 2018-09-19 22:19  人生苦短use,what?  阅读(65)  评论(0编辑  收藏  举报