Fix Interactive Route Map: Create MapRoute records from GPX files
- Create MapRoute database records for all GPX files for map visualization - Populate route statistics (distance, elevation, coordinates) from GPX parsing - Update GPX file statistics to mirror MapRoute data for post detail pages - Enable /community/api/routes endpoint to return proper route data for map iframe - Fix post detail page GPX statistics display This resolves the issue where the community map showed '2 routes discovered' but routes weren't actually rendering on the Leaflet.js map visualization. Changes: - Dockerfile: Updated init script paths and added migrate-db call - app/__init__.py: Added admin user auto-creation with error handling - app/routes/community.py: Added debug logging and API route for map data - docker-compose.yml: Simplified to use .env for environment variables - run.py: Added comprehensive database schema migration command
This commit is contained in:
@@ -25,13 +25,14 @@ ENV FLASK_APP=run.py
|
||||
|
||||
# Create a script to conditionally initialize database
|
||||
RUN echo '#!/bin/sh\n\
|
||||
if [ ! -f /data/moto_adventure.db ]; then\n\
|
||||
if [ ! -f /opt/moto_site/data/moto_adventure.db ]; then\n\
|
||||
echo "Database not found, initializing..."\n\
|
||||
flask --app run.py init-db\n\
|
||||
flask --app run.py create-admin\n\
|
||||
flask --app run.py migrate-db\n\
|
||||
echo "Database initialized successfully"\n\
|
||||
else\n\
|
||||
echo "Database already exists, skipping initialization"\n\
|
||||
echo "Database exists, running migrations..."\n\
|
||||
flask --app run.py migrate-db\n\
|
||||
fi' > /opt/moto_site/init_db_if_needed.sh && chmod +x /opt/moto_site/init_db_if_needed.sh
|
||||
|
||||
# Create non-root user and set permissions
|
||||
|
||||
Reference in New Issue
Block a user