Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Cecil Westerhof Newsgroups: comp.lang.python Subject: Re: SQLite3 and web server Date: Fri, 21 Aug 2015 17:23:04 +0200 Organization: Decebal Computing Lines: 35 Message-ID: <878u94psx3.fsf@Equus.decebal.nl> References: <87pp2hp3vg.fsf@Equus.decebal.nl> <55d6ca35$0$1665$c3e8da3$5496439d@news.astraweb.com> <87lhd5p0zv.fsf@Equus.decebal.nl> <87h9ntou1c.fsf@Equus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="528adfd6ad074c92fdc6a7f8fb9e23d8"; logging-data="22348"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4i4zAPr4FZq/AIcSHYcTubGHJ/eJRDY0=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Homepage: http://www.decebal.nl/ Cancel-Lock: sha1:UFKg2K4GzevVrNsB3/O+UTZIsEg= sha1:H+uc6FpgTZIyx1R98EpRIZkAxwQ= Xref: csiph.com comp.lang.python:95526 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