Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95521

Re: SQLite3 and web server

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 <torriem+gmail@torriefamily.org>
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 <torriem@gmail.com>
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> <mailman.6.1440142039.13558.python-list@python.org> <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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.8.1440166803.13558.python-list@python.org> (permalink)
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

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

SQLite3 and web server Cecil Westerhof <Cecil@decebal.nl> - 2015-08-21 08:11 +0200
  Re: SQLite3 and web server Steven D'Aprano <steve@pearwood.info> - 2015-08-21 16:50 +1000
    Re: SQLite3 and web server Cecil Westerhof <Cecil@decebal.nl> - 2015-08-21 09:13 +0200
      Re: SQLite3 and web server Chris Angelico <rosuav@gmail.com> - 2015-08-21 17:27 +1000
        Re: SQLite3 and web server Cecil Westerhof <Cecil@decebal.nl> - 2015-08-21 11:44 +0200
          Re: SQLite3 and web server Michael Torrie <torriem@gmail.com> - 2015-08-21 08:19 -0600
            Re: SQLite3 and web server Cecil Westerhof <Cecil@decebal.nl> - 2015-08-21 17:23 +0200
          Re: SQLite3 and web server Michael Torrie <torriem@gmail.com> - 2015-08-21 08:57 -0600
            Re: SQLite3 and web server Cecil Westerhof <Cecil@decebal.nl> - 2015-08-22 13:38 +0200
  Re: SQLite3 and web server Peter Otten <__peter__@web.de> - 2015-08-21 11:32 +0200
    Re: SQLite3 and web server Cecil Westerhof <Cecil@decebal.nl> - 2015-08-21 17:12 +0200
      Re: SQLite3 and web server Peter Otten <__peter__@web.de> - 2015-08-22 09:51 +0200
        Re: SQLite3 and web server Cecil Westerhof <Cecil@decebal.nl> - 2015-08-22 13:41 +0200
          Re: SQLite3 and web server Peter Otten <__peter__@web.de> - 2015-08-22 14:23 +0200

csiph-web