diff options
author | Justyna Ilczuk <justyna.ilczuk@gmail.com> | 2013-01-10 21:25:39 +0100 |
---|---|---|
committer | Justyna Ilczuk <justyna.ilczuk@gmail.com> | 2013-01-10 21:25:39 +0100 |
commit | e27d35ee8a767a97f23a308c3ed738d3f9f3078d (patch) | |
tree | 9388dc381a09efb81bd77b15722b9d6ca13c8da9 /sencha.py | |
download | sencha-web-e27d35ee8a767a97f23a308c3ed738d3f9f3078d.tar.gz sencha-web-e27d35ee8a767a97f23a308c3ed738d3f9f3078d.tar.bz2 sencha-web-e27d35ee8a767a97f23a308c3ed738d3f9f3078d.tar.xz sencha-web-e27d35ee8a767a97f23a308c3ed738d3f9f3078d.zip |
Sencha website - first draft. :)
Diffstat (limited to 'sencha.py')
-rw-r--r-- | sencha.py | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/sencha.py b/sencha.py new file mode 100644 index 0000000..854d0b9 --- /dev/null +++ b/sencha.py @@ -0,0 +1,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() + |