How to serve robots.txt from Masonite

49 Views Asked by At

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

There are 1 best solutions below

0
On BEST ANSWER

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