mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Admin shell (#6998)
* Add django-admin-shell package * Optionally enable debug shell - Requires debug mode - Requires admin integration * Add message if admin shell package not installed * Ignore qa for these lines
This commit is contained in:
parent
6fe0f746b6
commit
485045e9c0
@ -1,3 +1,3 @@
|
||||
# Dummy requirements file to trigger the package pipeline
|
||||
# The new requirements file is located in src/backend/requirements.txt
|
||||
# The backend requirements file is located in src/backend/requirements.txt
|
||||
#
|
||||
|
@ -288,6 +288,29 @@ QUERYCOUNT = {
|
||||
'RESPONSE_HEADER': 'X-Django-Query-Count',
|
||||
}
|
||||
|
||||
ADMIN_SHELL_ENABLE = False
|
||||
ADMIN_SHELL_IMPORT_DJANGO = False
|
||||
ADMIN_SHELL_IMPORT_MODELS = False
|
||||
|
||||
# In DEBUG mode, add support for django-admin-shell
|
||||
# Ref: https://github.com/djk2/django-admin-shell
|
||||
if (
|
||||
DEBUG
|
||||
and INVENTREE_ADMIN_ENABLED
|
||||
and get_boolean_setting('INVENTREE_DEBUG_SHELL', 'debug_shell', False)
|
||||
): # noqa
|
||||
try:
|
||||
import django_admin_shell
|
||||
|
||||
INSTALLED_APPS.append('django_admin_shell')
|
||||
ADMIN_SHELL_ENABLE = True
|
||||
|
||||
logger.warning('Admin shell is enabled')
|
||||
except ModuleNotFoundError:
|
||||
logger.warning(
|
||||
'django-admin-shell is not installed - Admin shell is not enabled'
|
||||
)
|
||||
|
||||
AUTHENTICATION_BACKENDS = CONFIG.get(
|
||||
'authentication_backends',
|
||||
[
|
||||
|
@ -435,7 +435,11 @@ classic_frontendpatterns = [
|
||||
urlpatterns = []
|
||||
|
||||
if settings.INVENTREE_ADMIN_ENABLED:
|
||||
admin_url = (settings.INVENTREE_ADMIN_URL,)
|
||||
admin_url = settings.INVENTREE_ADMIN_URL
|
||||
|
||||
if settings.ADMIN_SHELL_ENABLE: # noqa
|
||||
urlpatterns += [path(f'{admin_url}/shell/', include('django_admin_shell.urls'))]
|
||||
|
||||
urlpatterns += [
|
||||
path(f'{admin_url}/error_log/', include('error_report.urls')),
|
||||
path(f'{admin_url}/', admin.site.urls, name='inventree-admin'),
|
||||
|
@ -2,6 +2,7 @@
|
||||
-c requirements.txt
|
||||
coverage[toml] # Unit test coverage
|
||||
coveralls==2.1.2 # Coveralls linking (for tracking coverage) # PINNED 2022-06-28 - Old version needed for correct upload
|
||||
django-admin-shell # Remote shell access
|
||||
django-querycount # Display number of URL queries for requests
|
||||
django-slowtests # Show which unit tests are running slowly
|
||||
django-test-migrations # Unit testing for database migrations
|
||||
|
@ -24,7 +24,10 @@ cryptography==42.0.5
|
||||
distlib==0.3.8
|
||||
# via virtualenv
|
||||
django==4.2.11
|
||||
# via django-slowtests
|
||||
# via
|
||||
# django-admin-shell
|
||||
# django-slowtests
|
||||
django-admin-shell==2.0.1
|
||||
django-querycount==0.8.3
|
||||
django-slowtests==1.1.1
|
||||
django-test-migrations==1.3.0
|
||||
|
Loading…
Reference in New Issue
Block a user