top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Static files in Flask - robot.txt, sitemap.xml

+1 vote
687 views

Is there any clever solution to store static files in Flask's application root directory. robots.txt and sitemap.xml are expected to be found in /, so my idea was to create routes for them:

@app.route('/sitemap.xml', methods=['GET'])
def sitemap():
  response = make_response(open('sitemap.xml').read())
  response.headers["Content-type"] = "text/plain"
  return response

There must be something more convenient :)

posted Aug 15, 2013 by Abhay Kulkarni

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+5 votes

Question is related to the QueryHome Sitemap, want to know what is the meaning of priority field in the sitemap.xml and if it has any impact on the rank of the page.

+2 votes

I am developing a web application using flask, Werkzeug and jinja2. I am very much confused with these terms and wanted to know the meaning of the terms and how they are interrelated to the CGI environment variables. What is global variable g and how it is related to the application context and request context.

Also since I don't have much knowledge of developing web apps( I am doing it for first time) any another language also so there is another request if someone could give a reference or make me understand that how the requests are handled, i mean what happens when a request arrives to the web application.
Also if i am not using any openID providers for logging in the user into my website, how can i make the password secure. Should i use any framework for that?

+1 vote

In Socket-Programming, I want to send whole ".txt" file from server to client. is it possible?

+2 votes

How can we ensure my updated link in sitemap.xml is crawled-indexed by google faster. Are there options other than manually submitting urls.

...