Skip to content

Instantly share code, notes, and snippets.

@plasx
Created December 14, 2016 02:02
Show Gist options
  • Save plasx/c7276f6ebddf9b82611029caca0ed707 to your computer and use it in GitHub Desktop.
Save plasx/c7276f6ebddf9b82611029caca0ed707 to your computer and use it in GitHub Desktop.
import sqlite3
from flask import Flask, render_template
app = Flask(__name__)
conn = sqlite3.connect('example.db')
c = conn.cursor()
c.execute('''CREATE TABLE emails
(name text, email text)''')
c.execute("INSERT INTO emails VALUES ('melinda gates', 'bill@microsoft.com')")
conn.commit()
@app.route("/")
def hello(name="HAPPPPPPY"):
return render_template('hello.html',name=name)
@app.route("/MO")
def MO():
return "string"
if __name__ == "__main__":
app.run()
@plasx
Copy link
Author

plasx commented Dec 14, 2016

https://docs.python.org/2/library/sqlite3.html

virtualenv venv
source venv/bin/activate
pip install flask
python app.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment