Path: csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.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.027 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'pycon.': 0.04; '21,': 0.07; 'works.': 0.07; 'cc:addr:python-list': 0.09; 'similar,': 0.09; 'python': 0.10; 'server,': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'sqlite3': 0.16; 'subject:server': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; '(you': 0.23; 'header:In-Reply-To:1': 0.24; 'sort': 0.25; '(which': 0.26; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'regular': 0.29; 'accepts': 0.29; 'loads': 0.29; 'summary': 0.29; 'code': 0.30; 'another': 0.32; 'http': 0.33; 'info': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'method': 0.37; 'why': 0.39; 'data': 0.39; 'still': 0.40; 'some': 0.40; 'your': 0.60; 'video': 0.62; 'request.': 0.66; 'url:v': 0.72; 'url:youtube': 0.73; 'url:watch': 0.78; '"here\'s': 0.84; 'cecil': 0.84; 'chrisa': 0.84; 'thrust': 0.84; 'westerhof': 0.84; 'to:none': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=x9Lgx2ZXQzNR8owe2IXCWKVU+xKlhPUO0Au80OVxf4g=; b=Mpwa3/Zclmdm4+YeTjwXqjeSyOXy9bsfUGztMqJJvmh/GJRUCstolbaBaBh7X9dOG4 SeYjYdy+5SLJxEZfvLz/wHrJdOlIEzI7dE6LHNhKlIfU/gsCZevC5PRiJ0/RYCT4zSQb /QZk/srMqExylFNLQ7lv/+OB6WP6mOcx1Y8dEROKGlBoh4NNdvVXKhWmnC4bC3wf8CXJ 3DvuHMolBtAhZPopZiy27Gd40DoI0xMJXJOGidkAx4I9/22vbVVB2PQwqHELdBtZFq6i XPWf6QZAbkbGGcMI0R9S2bsNrJeopMzgIgWJX2QA10twhx1pwbzWOjvolnPkq9FO22Lt DpLw== MIME-Version: 1.0 X-Received: by 10.107.3.149 with SMTP id e21mr5516822ioi.19.1440142030549; Fri, 21 Aug 2015 00:27:10 -0700 (PDT) In-Reply-To: <87lhd5p0zv.fsf@Equus.decebal.nl> References: <87pp2hp3vg.fsf@Equus.decebal.nl> <55d6ca35$0$1665$c3e8da3$5496439d@news.astraweb.com> <87lhd5p0zv.fsf@Equus.decebal.nl> Date: Fri, 21 Aug 2015 17:27:10 +1000 Subject: Re: SQLite3 and web server From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1440142039 news.xs4all.nl 23820 [2001:888:2000:d::a6]:42906 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:95518 On Fri, Aug 21, 2015 at 5:13 PM, Cecil Westerhof wrote: > I know how to work with SQLite. What I do not know how to make a > python web-server that accepts a request from the JavaScript code and > responds with data from the SQLite3 database. The request from JS will be some sort of HTTP transaction. It'll be AJAX or similar, and to your web server, it'll simply be another page request. (You might be using a method other than GET/POST (which are the only two that regular page loads use), but it's still a standard HTTP request.) You then respond to that request with data that you got from the database. Check out this video from PyCon. Its main thrust is "here's why websockets are great, and why other technologies are insufficient", but the background info is a tidy summary of how the web works. https://www.youtube.com/watch?v=u5QT3luWx7w ChrisA