附录

1.查看django版本

python -m django --version

2.When to use include()

You should always use `include()` when you include other URL patterns. `admin.site.urls` is the only exception to this.
  1. django中的路由机制是由urls.py完成的

  2. settings.py

    • If you set DEBUG to False, you also need to properly set the ALLOWED_HOSTSsetting.

    • 修改配置文件名称需要同步修改wsgi中的DJANGO_SETTINGS_MODULE

  3. Default settings

    1. A Django settings file doesn’t have to define any settings if it doesn’t need to. Each setting has a sensible default value. These defaults live in the module django/conf/global_settings.py.

    2. Here’s the algorithm Django uses in compiling settings:

      1. Load settings from global_settings.py.

      2. Load settings from the specified settings file, overriding the global settings as necessary.

    3. Note that a settings file should not import from global_settings, because that’s redundan

posted @ 2020-05-28 21:13  炜琴清  阅读(118)  评论(0编辑  收藏  举报