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

相关文章:

  • 2022-12-23
  • 2021-04-07
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-03
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
  • 2021-04-09
  • 2022-12-23
相关资源
相似解决方案