SQLite3 and web server

Cecil Westerhof Cecil at decebal.nl
Fri Aug 21 17:23:04 CEST 2015


On Friday 21 Aug 2015 16:19 CEST, Michael Torrie wrote:

> On 08/21/2015 03:44 AM, Cecil Westerhof wrote:
>> Interesting, but it does not help me. I need to know how to server
>> data from SQLite instead of static files.
>
> Is your program already working with data coming from your Python
> dict? If so, you would just replace the python dict lookups with a
> call to SQLite3's function to perform a query on the database. You
> say you already know how to work with SQLite, so I assume this is
> what you're doing.
>
> http://raspberrywebserver.com/sql-databases/accessing-an-sqlite-database-with-python.html
>
> As to the traceback you reported, I don't know enough about using
> http.server and socketserver to answer. Typically web development in
> Python is done via WSGI protocol, in conjunction with a web server
> like Apache using mod_wsgi[1], which is available in most distro's
> repos.
>
> But of course you can use straight CGI with Apache too. Probably
> this is the easiest way for you to get started. Don't try to run
> your own http server. That's just a waste of time and effort. Run
> the CGIs under Apache. Google for Apache CGI to get info on how to
> set up apache to execute CGI scripts (in any language).
>
> [1] https://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide

I did manage to get something working:
    https://github.com/CecilWesterhof/PublishedPhotos

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


More information about the Python-list mailing list