aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/__init__.py
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-10-13 10:07:51 +0200
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-10-13 10:07:51 +0200
commitabec11e7ca0ce49081343bb2b2eb8520058d67a8 (patch)
tree9aeb6f19650c4d62a4b539ad0c1a9d1f83c6c843 /pyaggr3g470r/__init__.py
parentRemoved all .py files. (diff)
downloadnewspipe-abec11e7ca0ce49081343bb2b2eb8520058d67a8.tar.gz
newspipe-abec11e7ca0ce49081343bb2b2eb8520058d67a8.tar.bz2
newspipe-abec11e7ca0ce49081343bb2b2eb8520058d67a8.zip
Added new files. First prototype with the Flask micro-framework.
Diffstat (limited to 'pyaggr3g470r/__init__.py')
-rw-r--r--pyaggr3g470r/__init__.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/pyaggr3g470r/__init__.py b/pyaggr3g470r/__init__.py
new file mode 100644
index 00000000..41986fb4
--- /dev/null
+++ b/pyaggr3g470r/__init__.py
@@ -0,0 +1,69 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+
+from flask import Flask, session, g
+from flask.ext.mongoengine import MongoEngine
+#from flask.ext.login import AnonymousUserMixin
+
+from flask.ext.admin import Admin
+from flask.ext.admin.contrib.mongoengine import ModelView
+from flask_debugtoolbar import DebugToolbarExtension
+
+import conf
+from models import *
+
+# Create Flask applicatio
+app = Flask(__name__)
+app.debug = True
+
+# Create dummy secrey key so we can use sessions
+app.config['SECRET_KEY'] = conf.WEBSERVER_SECRETKEY
+
+app.config['MONGODB_SETTINGS'] = {'DB': conf.DATABASE_NAME}
+app.config["MAIL_SERVER"] = conf.MAIL_HOST
+app.config["MAIL_PORT"] = conf.MAIL_PORT
+app.config["MAIL_USE_SSL"] = conf.MAIL_SSL
+app.config["MAIL_USERNAME"] = conf.MAIL_USERNAME
+#app.config["MAIL_PASSWORD"] = 'your-password'
+
+# Initializes the database
+db = MongoEngine(app)
+db.init_app(app)
+
+from views import mail
+mail.init_app(app)
+
+# For Flask-DebugToolbar
+app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False
+toolbar = DebugToolbarExtension(app)
+
+# Administration panel
+admin = Admin(app, name='pyAggr3g470r')
+# Add administrative views here
+class FeedView(ModelView):
+ column_filters = ['title', 'link']
+
+ column_searchable_list = ('title', 'link')
+
+ form_ajax_refs = {
+ 'tags': {
+ 'fields': ('title', 'link')
+ }
+ }
+class ArticleView(ModelView):
+ column_filters = ['title', 'link']
+
+ column_searchable_list = ('title', 'link')
+
+ form_ajax_refs = {
+ 'tags': {
+ 'fields': ('title', 'link')
+ }
+ }
+admin.add_view(FeedView(Feed))
+admin.add_view(ArticleView(Article))
+
+
+from pyaggr3g470r import views
bgstack15