From e61fc639db89346bae1e680c83e65de2796b0e42 Mon Sep 17 00:00:00 2001 From: mdivecky Date: Sat, 27 Aug 2022 13:20:44 +0200 Subject: [PATCH] create robots.txt to stop crawlers --- view/app.py | 10 ++++++++-- view/static/robots.txt | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 view/static/robots.txt diff --git a/view/app.py b/view/app.py index c42bb3c..3c0baa1 100644 --- a/view/app.py +++ b/view/app.py @@ -1,8 +1,7 @@ #!/usr/bin/python3 import sqlite3 -from flask import Flask, request, render_template -from flask import g +from flask import Flask, request, render_template, g, send_from_directory from flask_paginate import Pagination, get_page_parameter import confuse @@ -75,5 +74,12 @@ def feed_list(): } feeds.append(feed) return render_template('feeds.html', feeds=feeds) + + + +@app.route('/robots.txt') +def static_from_root(): + return send_from_directory(app.static_folder, request.path[1:]) + if __name__ == "__main__": app.run(host="0.0.0.0") \ No newline at end of file diff --git a/view/static/robots.txt b/view/static/robots.txt new file mode 100644 index 0000000..77470cb --- /dev/null +++ b/view/static/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / \ No newline at end of file