mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-14 08:19:54 +00:00
[dev] Django silk (#11001)
* Add developer support for django-silk * Update docs * Fix typo * Tweak docs * Revert ty version
This commit is contained in:
@@ -106,7 +106,7 @@ response = request.get('http://localhost:8080/api/part/', data=data, headers=hea
|
||||
|
||||
InvenTree has built-in support for using [oAuth2](https://oauth.net/2/) and OpenID Connect (OIDC) for authentication to the API. This enables using the instance as a very limited identity provider.
|
||||
|
||||
A default application using a public client with PKCE enabled ships with each instance. Intended to be used with the python api and configured with very wide scopes this can also be used for quick tests - the cliend_id is `zDFnsiRheJIOKNx6aCQ0quBxECg1QBHtVFDPloJ6`.
|
||||
A default application using a public client with PKCE enabled ships with each instance. Intended to be used with the python api and configured with very wide scopes this can also be used for quick tests - the client_id is `zDFnsiRheJIOKNx6aCQ0quBxECg1QBHtVFDPloJ6`.
|
||||
|
||||
#### Managing applications
|
||||
|
||||
|
||||
52
docs/docs/develop/index.md
Normal file
52
docs/docs/develop/index.md
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
title: InvenTree Development
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
If you are interested in contributing to InvenTree, then this section is for you! Here you will find information about the architecture of InvenTree, how to set up a development environment, and guidelines for contributing code or documentation.
|
||||
|
||||
### Architecture Overview
|
||||
|
||||
Read the [architecture overview](./architecture.md) to understand the high-level architecture of InvenTree, including how requests are processed, the backend and frontend architecture, and various components of the system.
|
||||
|
||||
### Contribution Guide
|
||||
|
||||
Start with the [contribution guide](./contributing.md) to understand how to get involved with the InvenTree project.
|
||||
|
||||
### Devcontainer Setup
|
||||
|
||||
We provide a [devcontainer](./devcontainer.md) configuration to help you quickly set up a development environment using vscode.
|
||||
|
||||
### Frontend Development
|
||||
|
||||
For information on developing the InvenTree frontend, refer to the [frontend development guide](./react-frontend.md).
|
||||
|
||||
## Profiling Tools
|
||||
|
||||
The InvenTree project supports integrated profiling tools to help developers analyze and optimize performance. Note that the following tools are intended for development use only and should not be enabled in production environments. In fact, they are explicitly disabled unless the server is running in [debug mode](../start/index.md#debug-mode).
|
||||
|
||||
### Django Silk
|
||||
|
||||
[django-silk](https://silk.readthedocs.io/en/latest/) is a profiling tool that can be used to monitor and analyze the performance of Django applications. It provides insights into SQL queries, request/response times, and more.
|
||||
|
||||
To enable django-silk profiling, ensure that the `debug_silk` option is set to `True` in your [config file](../start/config.md#configuration-file). Alternative, you can set the `INVENTREE_DEBUG_SILK` environment variable to enable this feature.
|
||||
|
||||
Once enabled, you can access the silk interface at the `/silk/` endpoint of your InvenTree instance.
|
||||
|
||||
!!! tip "Run Migrations"
|
||||
If you are enabling django-silk for the first time, you may need to run database migrations to create the necessary tables. You can do this by running `invoke migrate`.
|
||||
|
||||
### Django QueryCount
|
||||
|
||||
Enabling the `INVENTREE_DEBUG_QUERYCOUNT` setting will log (to the terminal) the number of database queries executed for each page load. This can be useful for identifying performance bottlenecks in the InvenTree server. Note that this setting is only available if `INVENTREE_DEBUG` is also enabled.
|
||||
|
||||
### Database Logging
|
||||
|
||||
Enabling the `INVENTREE_DB_LOGGING` setting will log all database queries to the terminal. This can be useful for debugging database-related issues.
|
||||
|
||||
### Internal Profiling Tools
|
||||
|
||||
In addition to the above third-party tools, InvenTree includes some internal profiling tools that can be enabled in debug mode. These tools can be used to provide additional insights into the performance of various components of the InvenTree server.
|
||||
|
||||
These profiling tools can be found in `./src/backend/InvenTree/profiling.py`.
|
||||
@@ -92,7 +92,8 @@ The following debugging / logging options are available:
|
||||
| Environment Variable | Configuration File | Description | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| INVENTREE_DEBUG | debug | Enable [debug mode](./index.md#debug-mode) | False |
|
||||
| INVENTREE_DEBUG_QUERYCOUNT | debug_querycount | Enable [query count logging](https://github.com/bradmontgomery/django-querycount) in the terminal | False |
|
||||
| INVENTREE_DEBUG_QUERYCOUNT | debug_querycount | Enable support for [django-querycount](../develop/index.md#django-querycount) middleware. | False |
|
||||
| INVENTREE_DEBUG_SILK | debug_silk | Enable support for [django-silk](../develop/index.md#django-silk) profiling tool. | False |
|
||||
| INVENTREE_DB_LOGGING | db_logging | Enable logging of database messages | False |
|
||||
| INVENTREE_LOG_LEVEL | log_level | Set level of logging to terminal | WARNING |
|
||||
| INVENTREE_JSON_LOG | json_log | log as json | False |
|
||||
@@ -103,13 +104,7 @@ The following debugging / logging options are available:
|
||||
|
||||
Enabling the `INVENTREE_DEBUG` setting will turn on [Django debug mode]({% include "django.html" %}/ref/settings/#debug). This mode is intended for development purposes, and should not be enabled in a production environment. Read more about [InvenTree debug mode](./index.md#debug-mode).
|
||||
|
||||
### Query Count Logging
|
||||
|
||||
Enabling the `INVENTREE_DEBUG_QUERYCOUNT` setting will log the number of database queries executed for each page load. This can be useful for identifying performance bottlenecks in the InvenTree server. Note that this setting is only available if `INVENTREE_DEBUG` is also enabled.
|
||||
|
||||
### Database Logging
|
||||
|
||||
Enabling the `INVENTREE_DB_LOGGING` setting will log all database queries to the terminal. This can be useful for debugging database-related issues.
|
||||
In debug mode, there are additional [profiling tools](../develop/index.md#profiling-tools) available to help developers analyze and optimize performance.
|
||||
|
||||
## Server Access
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ nav:
|
||||
- Demo: demo.md
|
||||
- Release Notes: releases/release_notes.md
|
||||
- Development:
|
||||
- InvenTree Development: develop/index.md
|
||||
- Contributing: develop/contributing.md
|
||||
- Architecture: develop/architecture.md
|
||||
- Roadmap: develop/roadmap.md
|
||||
|
||||
Reference in New Issue
Block a user