mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add information on copying templates to installation directory when developing a plugin (#6050)
This commit is contained in:
parent
974ea1ead3
commit
2dc164634d
@ -81,6 +81,32 @@ setuptools.setup(
|
|||||||
entry_points={"inventree_plugins": ["ShopifyIntegrationPlugin = path.to.source:ShopifyIntegrationPluginClass"]}
|
entry_points={"inventree_plugins": ["ShopifyIntegrationPlugin = path.to.source:ShopifyIntegrationPluginClass"]}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Including Extra Files
|
||||||
|
|
||||||
|
In some cases you may wish to copy across extra files when the package is installed. For example, you may have custom template files which need to be copied across to the installation directory.
|
||||||
|
|
||||||
|
In this case, you will need to include a `MANIFEST.in` file in the root directory of your plugin, and include the line `include_package_data=True` in your `setup.py` file.
|
||||||
|
|
||||||
|
!!! tip "Setuptools Documentation"
|
||||||
|
Read more about `MANIFEST.in` in the [setuptools documentation](https://setuptools.pypa.io/en/latest/userguide/miscellaneous.html)
|
||||||
|
|
||||||
|
As an example, you have a plugin codebase with the following directory structure:
|
||||||
|
|
||||||
|
```
|
||||||
|
- my_plugin # Core plugin code
|
||||||
|
- my_plugin/templates/ # Template files
|
||||||
|
- MANIFEST.in # Manifest file
|
||||||
|
- setup.py # Setuptools script
|
||||||
|
```
|
||||||
|
|
||||||
|
To ensure that the templates are copied into the installation directory, `MANIFEST.in` should look like:
|
||||||
|
|
||||||
|
```
|
||||||
|
recursive-include my_plugin/templates *
|
||||||
|
```
|
||||||
|
|
||||||
|
Other files and directories can be copied in a similar manner.
|
||||||
|
|
||||||
|
|
||||||
### A simple example
|
### A simple example
|
||||||
This example adds a new action under `/api/action/sample` using the ActionMixin.
|
This example adds a new action under `/api/action/sample` using the ActionMixin.
|
||||||
|
Loading…
Reference in New Issue
Block a user