Django override startapp | startproject commands

1.4k views Asked by At

I need to create a Django Project with a different files and folder structure. In particular I need to add 2 folders: qqapp and qqproject when creating a new app through the startapp command, each containing some base files.

How can I override the base commands or add a custom one?

My current solution is editing the base commands files (changing dir name for default folders) django/core/management/commands/startapp|project.py, but I think this is bad idea.

2

There are 2 answers

6
akonsu On
0
Bite code On

Use project templates for this.

django-admin.py startproject --template=/path/to/my_project_template myproject