Skip to content

torusheadstudios/DjangoSQLiteManagerPlugin

Repository files navigation

Django SQLite Manager Plugin

A lightweight Django app for managing SQLite databases through a web interface. Execute queries, manage multiple databases, create backups, and save query presets.

Features

  • 🗄️ Manage multiple SQLite databases
  • 📝 Execute SQL queries with a clean interface
  • 💾 Create timestamped database backups
  • 🔖 Save and load query presets
  • 📤 Export results to CSV
  • 🆕 Create new databases from the interface

Installation

pip install django-sqlite-manager-plugin

Setup

  1. Add to INSTALLED_APPS in settings.py:

    INSTALLED_APPS = [
        # ... other apps
        'sqlite_manager',
    ]
  2. Add URL pattern in your main urls.py:

    from django.urls import path, include
    
    urlpatterns = [
        # ... other urls
        path('sqlite-manager/', include('sqlite_manager.urls')),
    ]
  3. Run migrations and start server:

    python manage.py migrate
    python manage.py runserver
  4. Access at: http://localhost:8000/sqlite-manager/

Note: Directories databases/ and sqlite_presets/ are created automatically.

Configuration (Optional)

Disable in Production (Recommended)

Important: Disable SQLite Manager in production environments for security.

# settings.py

# Disable in production (returns 404)
SQLITE_MANAGER_ENABLED = False

# Or use environment variable (recommended)
import os
SQLITE_MANAGER_ENABLED = os.getenv('SQLITE_MANAGER_ENABLED', 'False').lower() == 'true'

Best Practice: Set to False by default, enable only in development:

# settings.py
DEBUG = os.getenv('DEBUG', 'False').lower() == 'true'
SQLITE_MANAGER_ENABLED = DEBUG  # Only enable when DEBUG is True

Custom Database Directory

# settings.py
SQLITE_MANAGER_DB_DIR = BASE_DIR / 'databases'  # default

Specific Database Path

# settings.py
SQLITE_MANAGER_DB_DIR = Path('/path/to/your/database/directory')

Usage

  • Execute Queries: Select a database, click a table name to load schema, write SQL, click "Run Query"
  • Create Database: Click "New Database", enter name
  • Backup Database: Select database, click "Backup" (creates timestamped copy)
  • Query Presets: Click "Save Current Query" to save, click preset name to load
  • Export CSV: Run a SELECT query, click "Export CSV"

Security Warning

⚠️ This is a development tool only

  • DO NOT deploy to production or expose to the public internet
  • DO NOT allow untrusted users to access this interface
  • No authentication or authorization built-in
  • Direct SQL execution capability

Production Safety: Set SQLITE_MANAGER_ENABLED = False in production settings to completely disable the app (returns 404). See Configuration section above.

Use only in local development environments. Always backup databases before running queries.

Requirements

  • Python ≥ 3.8
  • Django ≥ 4.2

License

MIT License - See LICENSE file for details.

Contributing

Contributions welcome! Open an issue or pull request on GitHub.


Remember: Development tool only. Keep it local, never expose to production! 🔒

About

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors