sanic/docs/static_files.md
Channel Cat bf6879e46f Made static file serving part of Sanic
Added sanic.static, blueprint.static, documentation, and testing
2016-10-24 01:21:06 -07:00

397 B

Static Files

Both directories and files can be served by registering with static

Example

app = Sanic(__name__)

# Serves files from the static folder to the URL /static
app.static('./static', '/static')

# Serves the file /home/ubuntu/test.png when the URL /the_best.png
# is requested
app.static('/home/ubuntu/test.png', '/the_best.png')

app.run(host="0.0.0.0", port=8000)