How to add robot.txt when using nginx, flask and uwsgi?

Posted May 8, 2017 4.6k views

After getting flask running with nginx and uwsgi with the help of this eminent community, and with the guide found here

I am confused since I can not understand how to add robot.txt to a site running flask.
Robot.txt is a static file, but how to configure to be able to run flask with robots.txt?

If I am not misstaken shouldn’t nginx handle static files and robot.txt in production?
How? Any guide toward correct answer is more than appreciated.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer


NGINX will serve pretty much anything you configure it to – whether static or dynamic.

Generally, you want to place the robots.txt file in the web root where you’re serving your app, but flask seems to work a little differently, so you’d most likely need to place in the root that you’ve set for your static file path.

You may want to check the following to see if it can help you to get things setup:

Submit an Answer