mirror of
https://github.com/PhialsBasement/LibreCrawl.git
synced 2026-10-18 00:19:37 +02:00
fix: ensure data directory exists before init_db call (#79)
sqlite3.connect() fails with 'unable to open database file' on fresh installs where data/ directory does not exist. This happens with both Docker (bind mount creates ./data as root, container user can't write) and bare Python (no data/ directory at all). Fix ensures data/ exists before any database operation: - main.py: add os.makedirs before init_db() call - start-librecrawl.sh: mkdir -p data at script start - start-librecrawl.bat: mkdir data at script start Fixes #65
This commit is contained in:
1 parent
d98ff55d84
commit
8f6dedb32d
3 files changed
+5
No files matched your search
@@ -54,6 +54,9 @@ if not os.environ.get('SECRET_KEY'):
|
||||
# Enable compression for all responses
|
||||
Compress(app)
|
||||
|
||||
# Ensure data directory exists before initializing the database
|
||||
os.makedirs("data", exist_ok=True)
|
||||
|
||||
# Initialize database on startup
|
||||
init_db()
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@echo off
|
||||
|
||||
if not exist data mkdir data␍
|
||||
echo Checking for Docker...
|
||||
docker --version 2>nul
|
||||
if errorlevel 1 goto nodocker
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
# Start LibreCrawl - tries Docker first, falls back to Python
|
||||
|
||||
mkdir -p data
|
||||
echo "Checking for Docker..."
|
||||
if command -v docker &> /dev/null && command -v docker compose &> /dev/null; then
|
||||
echo "Docker found! Starting LibreCrawl with Docker..."
|
||||
|
||||
Reference in new issue
Block a user