summaryrefslogtreecommitdiffstats
path: root/sencha.py
blob: 854d0b9d7547cd0424ce80fea96b16ca0e6693b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# all the imports
from __future__ import with_statement
from contextlib import closing
import sqlite3
from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, jsonify
import requests
from bs4 import BeautifulSoup
import re
from email.mime.text import MIMEText
from subprocess import Popen, PIPE
import smtplib

# configuration
DATABASE = '/tmp/dysprosium.db'
DEBUG = True
SECRET_KEY = 'development key'
USERNAME = 'admin'
PASSWORD = 'dupa.8'

app = Flask(__name__)
app.config.from_object(__name__)


def connect_db():
	return sqlite3.connect(app.config['DATABASE'])

def init_db():
	with closing(connect_db()) as db:
		 with app.open_resource('schema.sql') as f:
			 db.cursor().executescript(f.read())
			 db.commit()

@app.before_request
def before_request():
	g.db = connect_db()

@app.teardown_request
def teardown_request(exception):
	g.db.close()

@app.route('/')
def home():
	return render_template('sencha.html')

@app.route('/examples')
def examples():
	return render_template('examples.html')

@app.route('/docs')
def docs():
	return render_template('documentation.html')

@app.route('/source')
def source():
	return render_template('source.html')

@app.route('/contact')
def contact():
	return render_template('contact.html')

@app.route('/howtos')
def howtos():
	return render_template('howtos.html')
	
	


#this api is broken and inconsistent, I don't like it, mayby it'd be better to start with something different soon?
#a95ae api key for word reference is: a95ae
#http://www.wordreference.com/docs/api.aspx


if __name__ == '__main__':
	init_db()
	app.run()