在django中自定义项目和应用程序模板 [英] Customizing project and app templates in django
问题描述
我想自定义运行时创建的文件和文件夹
I would like to customize the files and folders created when running
python manage.py startapp appname
我发现一遍又一遍地做了一些事情,我认为这样会很整洁,如果我创建一个新的应用程式
I find doing some things over and over again and I think it would be neat, if my customizations are present when I create a new app.
您是否知道创建应用程序时可以自定义默认文件?
Do you know where I can customize the default files when an app is created?
推荐答案
该文件位于应用程序的 django / conf / app_template
和 django / conf / project_template
和项目文件。
The files are in django/conf/app_template
and django/conf/project_template
for the app and project files respectively.
我不认为有办法覆盖这个位置,而无需创建自己的 startapp
/ startproject
命令或不修改 django / core / management / base.py
。
I don't think there is a ways to override this location without either creating your own startapp
/ startproject
command or without modifying django/core/management/base.py
.
这篇关于在django中自定义项目和应用程序模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!