Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'static': 0.03; 'scripts': 0.09; 'dict': 0.09; 'sqlite': 0.09; 'python': 0.10; 'assume': 0.11; 'files.': 0.13; 'apache': 0.14; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'http.server': 0.16; 'lookups': 0.16; 'socketserver': 0.16; 'subject:server': 0.16; 'wsgi': 0.16; 'wrote:': 0.16; 'conjunction': 0.18; '(in': 0.18; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'function': 0.28; 'cgi': 0.29; 'typically': 0.29; 'server.': 0.30; 'too.': 0.30; 'url:wiki': 0.30; 'query': 0.30; 'waste': 0.30; 'probably': 0.31; '[1]': 0.32; 'run': 0.33; 'effort.': 0.33; 'http': 0.33; 'traceback': 0.33; 'message-id:@gmail.com': 0.34; 'url:code': 0.34; 'server': 0.34; 'info': 0.34; 'so,': 0.35; 'done': 0.35; 'easiest': 0.35; 'replace': 0.35; 'but': 0.36; 'instead': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'say': 0.37; 'received:org': 0.37; 'google': 0.39; 'data': 0.39; 'does': 0.39; 'enough': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'charset:windows-1252': 0.62; 'course': 0.62; 'started.': 0.66; 'answer.': 0.72; 'cecil': 0.84; 'westerhof': 0.84; 'interesting,': 0.93 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Fri, 21 Aug 2015 08:19:50 -0600 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: SQLite3 and web server References: <87pp2hp3vg.fsf@Equus.decebal.nl> <55d6ca35$0$1665$c3e8da3$5496439d@news.astraweb.com> <87lhd5p0zv.fsf@Equus.decebal.nl> <87h9ntou1c.fsf@Equus.decebal.nl> In-Reply-To: <87h9ntou1c.fsf@Equus.decebal.nl> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1440166803 news.xs4all.nl 23807 [2001:888:2000:d::a6]:60606 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:95521 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