Merge pull request #204 from Happilands/patch-1

Add robots.txt file
This commit is contained in:
redfast00 2023-04-22 17:52:17 +02:00 committed by GitHub
commit cdca5646ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,7 +10,7 @@ from logging.handlers import TimedRotatingFileHandler
from admin import init_admin from admin import init_admin
from config import Configuration from config import Configuration
from flask import Flask, render_template from flask import Flask, render_template, Response
from flask_bootstrap import Bootstrap, StaticCDN from flask_bootstrap import Bootstrap, StaticCDN
from flask_debugtoolbar import DebugToolbarExtension from flask_debugtoolbar import DebugToolbarExtension
from flask_login import LoginManager from flask_login import LoginManager
@ -161,6 +161,12 @@ def create_app():
"""Initializer for the Flask app object""" """Initializer for the Flask app object"""
app = Flask(__name__) app = Flask(__name__)
@app.route('/robots.txt')
def noindex():
r = Response(response="User-Agent: *\nDisallow: /\n", status=200, mimetype="text/plain")
r.headers["Content-Type"] = "text/plain; charset=utf-8"
return r
# Load the config file # Load the config file
app.config.from_object("config.Configuration") app.config.from_object("config.Configuration")