-
Notifications
You must be signed in to change notification settings - Fork 3
Customizing The Structure
This section will show you how to customize and create your own project structure.
The project is created using a Yaml file as base, and you can make your own that covers your needs.
This Yaml file has this structure:
name: $project_name
archives:
- name: folder1
archives: []
- name: folder2
archives:
- name: file.txt
- name: $project_name
archives:
- name: __init__.py
- name: manage.py
snippets: [default.manage.full]
...
And this will make an structure like:
|myProject
|----folder1
|----folder2
|----file.txt
|----myProject
|----__init__.py
|----manage.py
...
To define a folder just do:
- name: folder_name
archives: []
To put files inside a folder just do:
- name: folder_name
archives:
- name: file_name1
- name: file_name2
To define a file do it like this:
- name: file_name
To put a snippet inside a file do this:
- name: some_file
snippets: [some.nice.snippet]
To put more then one snippet inside a file:
- name: some_file
snippets: [some.nice.snippet,some.other.nice.snippet]
PS: Note that the order that the snippets are declared will be the order that they will appear in the file
There are some variables that can be used to make things more generic some of them are:
Is replaced by the project name when creating a new project.
Is replaced by the app name when creating a new app.
This var marks the folder that should contain the source files(the root one, that has the manage.py file)
This var tells Django-Structurer where is the app folder(used to generate your apps)
Put this var in the folder that should only be created when running the app_starter.py
To use the recently created structure file you just do:
djstruct.py proj "project name" /path/to/yaml/file.yaml
If you want to use different project structures more easily than saying the path to the file, you can use some environment variable to help you out.
See the [Environment Variables](Environment Variables) section to know how.
The snippets that comes with django-structurer is not what you want?
No problem, just create your own: [Creating Custom Snippets](Creating Snippets)