I'm trying to make a site in VS Code using Flask and Python, but I'm having problems with the image in the static folder not showing up on my site. Here's what my directory looks like:
Here's a snippet from base.html:
<!DOCTYPE html>
<html lang="ru">
<head>
<meta content="text/html; charset="utf-8" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}TheAkashicLibrary.com{% endblock %}</title>
</head>
<body>
<p style="display:inline-block;">
<h1 style="color: brown;"><image src="{{ url_for('static', filename='images/akashiclibrarybook.png') }}">
The Akashic Library</h1>
</p>
</body>
</html>
As you can see, I'm trying to display akashiclibrarybook.png which is in my static folder, but here's how it looks on my server:
Here's my views.py file:
from flask import Blueprint, render_template
views = Blueprint('views', __name__, template_folder="templates")
@views.route('/')
def home():
return render_template("home.html")
Here's my init.py file:
from flask import Flask
def create_app(__name__):
app = Flask(__name__)
app.config['SECRET_KEY'] = 'i love bananas'
from .views import views
from .auth import auth
app.register_blueprint (views, url_prefix='/')
app.register_blueprint (auth, url_prefix='/')
return app
Here's my main.py file:
from website import create_app
app = create_app(__name__)
if __name__ == '__main__':
app.run(debug=True)
I also get this error when clicking the link of my .png file in VS Code:
Why is it interpreting the file title this way? I tried writing Blueprint('views', name, static_folder='static') and importing url_for, but nothing changed. How do I fix this?