Fix: Clean up map_iframe_single.html, remove debug overlay, ensure clean map rendering.
This commit is contained in:
25
run.py
25
run.py
@@ -1,6 +1,6 @@
|
||||
import os
|
||||
from app import create_app, db
|
||||
from app.models import User, Post, PostImage, GPXFile, Comment, Like, PageView
|
||||
from app.models import User, Post, PostImage, GPXFile, Comment, Like, PageView, MapRoute
|
||||
|
||||
app = create_app()
|
||||
|
||||
@@ -14,7 +14,8 @@ def make_shell_context():
|
||||
'GPXFile': GPXFile,
|
||||
'Comment': Comment,
|
||||
'Like': Like,
|
||||
'PageView': PageView
|
||||
'PageView': PageView,
|
||||
'MapRoute': MapRoute
|
||||
}
|
||||
|
||||
@app.cli.command()
|
||||
@@ -121,6 +122,26 @@ def process_gpx_files():
|
||||
db.session.commit()
|
||||
print(f'Processed {processed}/{len(gpx_files)} GPX files')
|
||||
|
||||
@app.cli.command()
|
||||
def set_cover_images():
|
||||
"""Set cover images for posts that don't have them."""
|
||||
posts = Post.query.all()
|
||||
updated = 0
|
||||
|
||||
for post in posts:
|
||||
# Check if post has a cover image
|
||||
cover_image = post.images.filter_by(is_cover=True).first()
|
||||
if not cover_image:
|
||||
# Set the first image as cover if available
|
||||
first_image = post.images.first()
|
||||
if first_image:
|
||||
first_image.is_cover = True
|
||||
updated += 1
|
||||
print(f'Set cover image for post: {post.title}')
|
||||
|
||||
db.session.commit()
|
||||
print(f'Updated {updated} posts with cover images')
|
||||
|
||||
@app.cli.command()
|
||||
def create_admin():
|
||||
"""Create an admin user."""
|
||||
|
||||
Reference in New Issue
Block a user