You're using the name folder
in the route's path, but filename
as the sole parameter name. Luckily, the fix is easy: just use the same name in both places. (And also correct your use of folder
in static_file
's root
param:
@b.route('/database/<folder>/CONTCAR.xyz')
def server_static(folder):
return b.static_file('CONTCAR.xyz', root='./database/{}'.format(folder))
For two levels of folders, you'd do something like this:
@b.route('/database/<folder1>/<folder2>/CONTCAR.xyz')
def server_static(folder1, folder2):
return b.static_file('CONTCAR.xyz', root='./database/{}/{}'.format(folder1, folder2))