def create_app(): app = Flask(__name__) app.debug = True #app.config.from_object('config') #app.config['SECRET_KEY'] = 'devkeytestibsvbdsvbsd' #app.config['DEBUG_TB_PANELS'] = ['flask_mongoengine.panels.MongoDebugPanel'] #app.config['MONGODB_SETTINGS'] = {'db': 'testing'} #toolbar = DebugToolbarExtension(app) #toolbar.init_app(app) #app.config['DISQUS_SECRET_KEY'] #app.config['DISQUS_PUBLIC_KEY'] #app.config['CKEDITOR_HEIGHT'] = 400 #app.config['CKEDITOR_FILE_UPLOADER'] = 'upload' #app.config['UPLOADED_PATH'] = basedir + '/uploads' add_oembed_filters(app, oembed_providers) app.config['SECRET_KEY'] = os.urandom(24) app.config['CKEDITOR_PKG_TYPE'] = 'full' app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False #app.config['THUMBNAIL_MEDIA_ROOT'] = '/home/www/media' #app.config['THUMBNAIL_MEDIA_URL'] = '/media/' app.config['MONGODB_SETTINGS'] = { 'db': 'testing', 'connect': False, } register_babel(app) register_jinjia_filters(app) init_login(app) register_blueprints(app) register_database(app) create_admin(app) Material(app) disq = Disqus(app) ckeditor = CKEditor(app) #thumb = Thumbnail(app) #csrf.init_app(app) return app
markdown=markdown, posts=pagination_posts, page=page, per_page=per_page, pagination=pagination, ) @app.route('/search/') def notsearch(): return redirect(url_for('home')) @app.errorhandler(404) def page_not_found(e): return render_template('404.html', category_list=category_list), 404 @app.errorhandler(401) def custom_401(e): return render_template('401.html', category_list=category_list), 401 @app.errorhandler(500) def internal_error(e): return render_template('500.html', category_list=category_list), 500 if __name__ == '__main__': disq = Disqus(app) app.run(host='0.0.0.0', port=7273)