def searchbox(): term = request.args['term'] if not re.match(ur"^[a-zA-Z0-9\s_áéíóúÁÉÍÓÚñÑ]+$", term): return "" term = term.encode('translit/long') if len(term) >= 1: return simplejson.dumps(Entry.search_terms(term)) else: return "" """ # make apache handle it later on @app.errorhandler(404) def page_not_found(error): return render_template('404.html'), 404 @app.errorhandler(500) def page_not_found(error): return render_template('404.html'), 500 """ if __name__ == "__main__": from flask import Flask app = Flask(__name__) app.config.update( SECRET_KEY=settings.SECRET_KEY, DEBUG=True, ) app.run()
term = request.args['term'] if not re.match(ur"^[a-zA-Z0-9\s_áéíóúÁÉÍÓÚñÑ]+$", term): return "" term = term.encode('translit/long') if len(term) >= 1: return simplejson.dumps(Entry.search_terms(term)) else: return "" """ # make apache handle it later on @app.errorhandler(404) def page_not_found(error): return render_template('404.html'), 404 @app.errorhandler(500) def page_not_found(error): return render_template('404.html'), 500 """ if __name__ == "__main__": from flask import Flask app = Flask(__name__) app.config.update( SECRET_KEY=settings.SECRET_KEY, DEBUG=True, ) app.run()
# -*- coding:utf-8 -*- # Insert Project Root Dir to path import sys import imp from os.path import join try: imp.find_module('settings') # Assumed to be in the same directory except ImportError: sys.stderr.write("Error: Can't find the file 'settings.py' in the directory") sys.exit(1) import settings sys.path.insert(0, settings.ROOT_DIR) # Insert Root dir into Path from qchapp import app import settings app.secret_key = settings.SECRET_KEY app.debug = True if app.debug: #Logging import logging file_handler = logging.FileHandler('logs/qchapp.log') file_handler.setLevel(logging.WARNING) app.logger.addHandler(file_handler) if __name__ == '__main__': app.run(debug=True)