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?
To configure the Django template system, go to the settings.py file and update the DIRS to the path of the templates folder. Generally, the templates folder is created and kept in the sample directory where manage.py lives. This templates folder contains all the templates you will create in different Django Apps.
There are two main ways to organize your template structure in Django: the default app-level way and a custom project-level approach.
{% extends variable %} uses the value of variable . If the variable evaluates to a string, Django will use that string as the name of the parent template. If the variable evaluates to a Template object, Django will use that object as the parent template.
With APP_DIRS set to True , the template loader will look in the app's templates directory and find the templates.
startapp and startproject accept a --template flag with which you can specify a directory or compressed file that the command should use as a template for you new app or project.  It also passes in a context with your app/project name that you can insert into your templates with template tags.
See https://docs.djangoproject.com/en/dev/ref/django-admin/#startapp-appname-destination for the details.
It looks like this was added in 1.4.
The files are in django/conf/app_template and django/conf/project_template for the app and project files respectively.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With