SQLite3 and web server

Peter Otten __peter__ at web.de
Sat Aug 22 14:23:28 CEST 2015


Cecil Westerhof wrote:

> On Saturday 22 Aug 2015 09:51 CEST, Peter Otten wrote:
> 
>> Cecil Westerhof wrote:
>>
>>> Thanks. I made a first try:
>>> https://github.com/CecilWesterhof/PublishedPhotos
>>>
>>> The thing I do not like is that all my static files have to be put
>>> in /static/, but I think I can life with it.
>>
>> Is that really required by bottle? Where would you like to put the
>> files?
> 
> That is how I interpret this:
>     http://bottlepy.org/docs/dev/tutorial.html#routing-static-files

No, /static/ is in no way special. To drive the point home here's a bogus 
example that gives you a random file from the ~/.thumbnails/large folder:
 
@bottle.route("/<path:path>")
def random_thumbnail(path):
    root = os.path.expanduser("~/.thumbnails/large")
    name = random.choice(os.listdir(root))
    return bottle.static_file(name, root=root)

The path is not even taken into account.



More information about the Python-list mailing list