SQLite3 and web server

Michael Torrie torriem at gmail.com
Fri Aug 21 16:19:50 CEST 2015


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


More information about the Python-list mailing list