mirror of
https://github.com/lucaspalomodevelop/eventcally.git
synced 2026-03-13 00:07:22 +00:00
Merge pull request #130 from DanielGrams/issue/129-robots
Missing robots.txt causes internal server error #129
This commit is contained in:
commit
48cbc4e8cd
@ -56,8 +56,10 @@ cache_path = (
|
||||
)
|
||||
dump_path = os.path.join(cache_path, "dump")
|
||||
img_path = os.path.join(cache_path, "img")
|
||||
sitemap_path = os.path.join(cache_path, "sitemap.xml")
|
||||
robots_txt_path = os.path.join(cache_path, "robots.txt")
|
||||
sitemap_file = "sitemap.xml"
|
||||
robots_txt_file = "robots.txt"
|
||||
sitemap_path = os.path.join(cache_path, sitemap_file)
|
||||
robots_txt_path = os.path.join(cache_path, robots_txt_file)
|
||||
|
||||
# i18n
|
||||
app.config["BABEL_DEFAULT_LOCALE"] = "de"
|
||||
|
||||
@ -233,7 +233,7 @@
|
||||
{% if link %}
|
||||
<div>
|
||||
<i class="fa fa-fw fa-link" data-toggle="tooltip" title="{{ _('Link') }}"></i>
|
||||
<a href="{{ link }}" target="_blank" rel="noopener noreferrer">{{ link }}</a>
|
||||
<a href="{{ link }}" target="_blank" rel="noopener noreferrer" style="word-break: break-all;">{{ link }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
@ -1,18 +1,11 @@
|
||||
import json
|
||||
import os.path
|
||||
|
||||
from flask import (
|
||||
redirect,
|
||||
render_template,
|
||||
request,
|
||||
send_file,
|
||||
send_from_directory,
|
||||
url_for,
|
||||
)
|
||||
from flask import redirect, render_template, request, send_from_directory, url_for
|
||||
from flask_babelex import gettext
|
||||
from markupsafe import Markup
|
||||
|
||||
from project import app, dump_path, robots_txt_path, sitemap_path
|
||||
from project import app, cache_path, dump_path, robots_txt_file, sitemap_file
|
||||
from project.services.admin import upsert_settings
|
||||
from project.views.utils import track_analytics
|
||||
|
||||
@ -97,9 +90,9 @@ def static_from_root():
|
||||
|
||||
@app.route("/robots.txt")
|
||||
def robots_txt():
|
||||
return send_file(robots_txt_path)
|
||||
return send_from_directory(cache_path, robots_txt_file)
|
||||
|
||||
|
||||
@app.route("/sitemap.xml")
|
||||
def sitemap_xml():
|
||||
return send_file(sitemap_path)
|
||||
return send_from_directory(cache_path, sitemap_file)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user