final update
This commit is contained in:
@@ -5,6 +5,7 @@ WORKDIR /app
|
||||
# Install system dependencies, including Rust and build tools
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libreoffice poppler-utils ffmpeg \
|
||||
libpoppler-cpp-dev libmagic1 \
|
||||
libffi-dev libssl-dev g++ curl libjpeg-dev zlib1g-dev \
|
||||
libxml2-dev libxslt-dev build-essential cargo \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
Binary file not shown.
18
app.py
18
app.py
@@ -622,6 +622,22 @@ def debug_content_positions(group_id):
|
||||
|
||||
return jsonify(content_data)
|
||||
|
||||
@app.cli.command("create-admin")
|
||||
@click.option("--username", default="admin", help="Admin username")
|
||||
@click.option("--password", help="Admin password")
|
||||
def create_admin(username, password):
|
||||
"""Create an admin user."""
|
||||
from models import User
|
||||
from extensions import bcrypt
|
||||
|
||||
hashed_password = bcrypt.generate_password_hash(password).decode('utf-8')
|
||||
user = User(username=username, password=hashed_password, role='admin')
|
||||
db.session.add(user)
|
||||
db.session.commit()
|
||||
print(f"Admin user '{username}' created successfully.")
|
||||
|
||||
|
||||
# Add this at the end of app.py
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host='0.0.0.0', port=5000)
|
||||
app.run(debug=True, host='0.0.0.0', port=5000)
|
||||
|
||||
|
||||
@@ -1,11 +1,31 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Initialize the database and run migrations
|
||||
flask db upgrade
|
||||
|
||||
# Create necessary directories
|
||||
mkdir -p static/uploads static/resurse
|
||||
mkdir -p instance
|
||||
|
||||
# Check if database exists
|
||||
if [ ! -f instance/dashboard.db ]; then
|
||||
echo "No database found, initializing..."
|
||||
|
||||
# Initialize the database
|
||||
flask db init
|
||||
flask db migrate -m "Initial migration"
|
||||
flask db upgrade
|
||||
|
||||
# Create admin user if environment variables are set
|
||||
if [ -n "$ADMIN_USER" ] && [ -n "$ADMIN_PASSWORD" ]; then
|
||||
echo "Creating admin user: $ADMIN_USER"
|
||||
flask create-admin --username "$ADMIN_USER" --password "$ADMIN_PASSWORD"
|
||||
else
|
||||
echo "Warning: ADMIN_USER or ADMIN_PASSWORD not set, skipping admin creation"
|
||||
fi
|
||||
else
|
||||
echo "Existing database found, applying migrations..."
|
||||
flask db upgrade
|
||||
fi
|
||||
|
||||
echo "Starting DigiServer..."
|
||||
# Start the application
|
||||
exec flask run --host=0.0.0.0
|
||||
@@ -1,25 +1,46 @@
|
||||
alembic==1.14.1
|
||||
bcrypt==4.2.1
|
||||
blinker==1.9.0
|
||||
click==8.1.8
|
||||
# Core Flask
|
||||
Flask==3.1.0
|
||||
Werkzeug==3.1.3
|
||||
Jinja2==3.1.5
|
||||
itsdangerous==2.2.0
|
||||
click==8.1.8
|
||||
blinker==1.9.0
|
||||
|
||||
# Flask Extensions
|
||||
Flask-SQLAlchemy==3.1.1
|
||||
Flask-Migrate==4.1.0
|
||||
Flask-Bcrypt==1.0.1
|
||||
Flask-Login==0.6.3
|
||||
Flask-Migrate==4.1.0
|
||||
Flask-SQLAlchemy==3.1.1
|
||||
greenlet==3.1.1
|
||||
itsdangerous==2.2.0
|
||||
Jinja2==3.1.5
|
||||
Mako==1.3.8
|
||||
MarkupSafe==3.0.2
|
||||
|
||||
# Database
|
||||
SQLAlchemy==2.0.37
|
||||
typing_extensions==4.12.2
|
||||
Werkzeug==3.1.3
|
||||
gunicorn==20.1.0
|
||||
alembic==1.14.1
|
||||
Mako==1.3.8
|
||||
greenlet==3.1.1
|
||||
|
||||
# File Processing
|
||||
pdf2image==1.17.0
|
||||
PyPDF2==3.0.1
|
||||
python-pptx==0.6.21
|
||||
cairosvg==2.7.0
|
||||
Pillow==10.0.1
|
||||
cairosvg==2.7.0
|
||||
ffmpeg-python==0.2.0
|
||||
python-magic==0.4.27
|
||||
PyPDF2==3.0.1
|
||||
|
||||
# Security
|
||||
bcrypt==4.2.1
|
||||
Flask-Talisman==1.1.0
|
||||
Flask-Cors==4.0.0
|
||||
|
||||
# Production Server
|
||||
gunicorn==20.1.0
|
||||
gevent==23.9.1
|
||||
|
||||
# Monitoring & Performance
|
||||
prometheus-flask-exporter==0.22.4
|
||||
sentry-sdk[flask]==1.40.0
|
||||
|
||||
# Utilities
|
||||
typing_extensions==4.12.2
|
||||
MarkupSafe==3.0.2
|
||||
python-dotenv==1.0.1
|
||||
|
||||
Reference in New Issue
Block a user