Django 1.9 deprecation warnings app_label

后端 未结 12 704
花落未央
花落未央 2020-12-01 05:09

I\'ve just updated to Django v1.8, and testing my local setup before updating my project and I\'ve had a deprecation warning that I\'ve never seen before, nor does it make a

12条回答
  •  情深已故
    2020-12-01 05:23

    The Django 1.9 way of handling this and giving your app a nice name in the admin is to do the following:

    Add a file in your app named apps.py and add the following to it:

    #apps.py
    from django.apps import AppConfig
    
    
    class YourAppNameAppConfig(AppConfig):
        name = 'yourappname'
        verbose_name = 'Your App Name Looking Right'
    

    Then, in your app's __init__.py file, add the following:

    #__init__.py    
    default_app_config = 'youappname.apps.YourAppNameAppConfig'
    

提交回复
热议问题