Back to questions

Leandro Kyda on October 20 - 01:10:35
How to serve robots.txt from Masonite

I want to serve the files like robots.txt, humans.txt and manifest.json.

I saw the docs, I didn't find a solution, I have found view.render only serve HTML not text or JSON or any other file.

1 Answer

Junior Gantin on October 20 - 01:11:39

Add folder path and alias in config/storage.py

config/storage.py

STATICFILES = { 'storage/static': 'static/', 'storage/compiled': 'static/', 'storage/uploads': 'static/', 'storage/root': '/' # add this line } Create root folder inside storage and put the robots.txt in root folder.

visit localhost:8000/robots.txt