Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

No project description provided

Project description

django-admin-shell Requirements Status

Django application can execute python code in your project’s environment on django admin site. You can use similar as python manage shell without reloading the environment.

  • Tested by tox with:
    • Python :2.7, 3.6
    • Django : 1.9, 1.10, 1.11, 2.0, 2.1, 2.2, 3.0
  • Require:
    • Django >= 1.9
  • Tested on browsers
    • OK - Chromium 79.0 - Ubuntu 18.04
    • OK - Firefox 72.0.2 - Ubuntu 18.04
    • OK - Firefox 50.1.0 - Ubuntu 14.04
    • OK - Firefox 31.1 - CentOS 6.4
    • OK - Chromium 53.0 - Ubuntu 14.04
    • OK - Microsoft Edge 38 - Windows 10
    • OK - Internet Explorer 11.0 - Windows 8.1
    • OK - Internet Explorer 10.0 - Windows 7
    • OK - Internet Explorer 9.0 - Windows 7
    • ERR - Internet Explorer 8.0 - Windows 7 (javascripts not working / console work properly)


Django admin shell view

Shell in action


  1. Install:

    pip install django-admin-shell
    pip install git+
    or after download zip
    pip install
  2. Add django_admin_shell to your INSTALLED_APPS setting

  1. Add the django_admin_shell urls to your root url patterns (above admin/) :

urlpatterns = [
    url(r'^admin/shell/', include('django_admin_shell.urls')),


  • shell is available on url: /admin/shell
  • On default settings user must be authenticated to django admin site and User must have superuser permission and DEBUG mode must be set on True.


Make sure that in your project session is enable

More about session and how enabling session read here :

Usualy default session in django project is enable



type : bool

default : True

If shell is enable or disable. When application is disable then url: /admin/shell return Http404 Not found


type : bool

default : True

If flag is set on True, then shell is available only in DEBUG mode.

If debug mode is required and debug mode is disabled then url: /admin/shell will return Http 403 Forbidden


type : bool

default : True

If flag is set on True, then shell is available only for user with superuser permission.

If superuser is required and user not have permission then url: /admin/shell will return Http 403 Forbidden


type : integer

default : 250

Flag determines how many outputs can be remember.


type : string

default : django_admin_shell_output

Name for key in session where is stored history last executed codes.

Code examples

  • show django settings:

    from django.conf import settings
    for key in dir(settings):
        val = getattr(settings, key, None)
        print(key, "=", val)
  • run command in operating system and take output:

    import os
    os.system('date > /tmp/admin_console.tmp')
    os.system('echo ------- >> /tmp/admin_console.tmp')
    os.system('who >> /tmp/admin_console.tmp')
    os.system('echo ------- >> /tmp/admin_console.tmp')
    os.system('ps aux | grep python >> /tmp/admin_console.tmp')
    with open('/tmp/admin_console.tmp', 'r') as f:
  • run big python code (get python source from website):

    import requests
    req = requests.get('')
    if req.status_code == 200:
        code = req.text
        print(code, '\n------------\n')

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-admin-shell, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size django_admin_shell-0.1.2-py2.py3-none-any.whl (182.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django-admin-shell-0.1.2.tar.gz (177.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page