Yes, you'll need to update each routes.py to match the new blueprint names and their respective template files. Here are the routes.py files for all four apps:
passport_photo/routes.py
python
from . import passport_photo
from flask import g, render_template
@passport_photo.route('/')
def index():
return render_template('passport_photo.html', nonce=g.nonce)
background_remover/routes.py
python
from . import background_remover
from flask import g, render_template
@background_remover.route('/')
def index():
return render_template('background_remover.html', nonce=g.nonce)
base64_form/routes.py
python
from . import base64_form
from flask import g, render_template
@base64_form.route('/')
def index():
return render_template('base64_form.html', nonce=g.nonce)
base64_file/routes.py
python
from . import base64_file
from flask import g, render_template
@base64_file.route('/')
def index():
return render_template('base64_file.html', nonce=g.nonce)
Key changes in each file:
Import the correct blueprint instance (not bp)
Use the blueprint-specific template name
Maintain the nonce security feature
Make sure you have corresponding HTML templates in each blueprint's templates folder:
Each template will be rendered with the security nonce available as {{ nonce }} in the template.
User
For my passport_photo.html, how I will set the path so that the template will use the static from the local static folder set in the blueprints and not the default after sharing the base.html and navigation.html
Assistant
For your passport_photo.html template, you'll need to use the correct static URL path that was defined in your blueprint. Here's how to structure it:
passport_photo/templates/passport_photo.html
html
{% extends "base.html" %}
{% include 'navigation.html' %}
{% block content %}
<!-- Use the blueprint-specific static URL path -->
<link rel="stylesheet" href="{{ url_for('passport_photo.static', filename='css/passport_photo.css') }}">
<script src="{{ url_for('passport_photo.static', filename='js/passport_photo.js') }}" nonce="{{ nonce }}"></script>
<!-- Your passport photo HTML content -->
<div class="container">
<!-- Example structure -->
<div class="passport-photo-container">
<!-- Your content here -->
</div>
</div>
{% endblock %}
Key Points:
Static File URLs: Use url_for('blueprint_name.static', filename='path') format