Skip to content

HuaiYu-Yang/flask-sqlite-management-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask SQLite Management System

中文说明

Python Flask License: MIT

Lightweight Flask app to manage SQLite databases with login, table browsing, and basic CRUD.

Features

  • Login with roles (admin or user).
  • List .db files from allowed directories.
  • Browse tables and data.
  • Search across fields (excluding id).
  • Add, edit, and delete records.

Requirements

  • Python 3.8+
  • Packages: see requirements.txt

Quick start

  1. Install requirements:
pip install -r requirements.txt
  1. Create a user:
python tools/add_user.py admin your_password admin
  1. Run the app:
python app.py
  1. Open: http://127.0.0.1:2000

Usage

  • Login with the user you created in tools/add_user.py.
  • The admin page lets you select a database directory and a .db file.
  • Choose a table to view data, search rows, or edit/add/delete records.
  • To seed sample tables/data for tasks.db, run:
python tools/add_table.py
  • To set app autostart (and optionally remove it), run:
python tools/autostart_setup.py
python tools/autostart_setup.py --remove
  • To reinitialize databases and clear data (with confirmation), run:
python tools/init_system.py

Allowed database directories

Configured in app.py:

  • . (current directory)
  • ../databases (create this folder and drop .db files there if needed)

Project structure

  • app.py: Flask routes and UI logic.
  • tools/database.py: app database connection and initialization.
  • tools/add_user.py: create login users.
  • tools/add_table.py: example tables and seed data for tasks.db.
  • tools/init_system.py: initialize schemas and optionally clear all data.
  • tools/autostart_setup.py: autostart setup helper.
  • data.db: main app database (users, items).
  • tasks.db: example database (sample schema).
  • templates/, static/: UI assets.

Tools

Helper scripts live in tools/:

  • tools/add_user.py: create a login user.
  • tools/add_table.py: create sample tables/data for tasks.db.
  • tools/init_system.py: initialize schemas and optionally clear all data.
  • tools/autostart_setup.py: set or remove autostart for the app.

Notes

  • This is a simple local admin tool; do not expose it directly to the public internet.
  • Change app.secret_key in app.py before any real usage.
  • tasks.db is a sample database; feel free to design your own schema based on it.

License

MIT

About

一个轻量的 Flask 应用,用于登录后管理 SQLite 数据库,支持浏览与基础增删改查。Lightweight Flask app to manage SQLite databases with login, table browsing, and basic CRUD.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors