SQLite3 and web server

Cecil Westerhof Cecil at decebal.nl
Fri Aug 21 11:12:57 EDT 2015


On Friday 21 Aug 2015 11:32 CEST, Peter Otten wrote:

> Cecil Westerhof wrote:
>
>> At the moment I serve a AngularJS web application with:
>> python3 -m http-server
>>
>> This only servers static html pages with the data contained in js
>> files, like:
>> $scope.links = [
>> { desc: 'Album',            url:
>> { 'https://plus.google.com/collection/MuwPX'                 
>> { }, desc: 'Heron Sunbathing', url:
>
>> I would like to retrieve the information out a SQLite3 database. I
>> did some Googling, but until now I did not find something useful.
>> How would I implement this?
>
> I like bottle for (not much) dabbling around with generated html.
> Assuming there is an sqlite database "links.sqlite" with a table
> "links" featuring columns "desc" and "url" you get a traditional
> html page built on the fly from the data in that table with the code
> shown below. Producing JSON is also demonstrated.

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.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof



More information about the Python-list mailing list