aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/__init__.py
blob: a26135acaeb13e2d3d43c0fb52e94fed294383fa (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
#! /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 LoginManager, AnonymousUserMixin

from flask.ext.admin import Admin
from flask.ext.admin.contrib.mongoengine import ModelView

import conf
from models import *

# Create Flask application
app = Flask(__name__)
app.debug = True

# Create dummy secrey key so we can use sessions
app.config['SECRET_KEY'] = os.urandom(12)

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)

# Administration panel
admin = Admin(app, name='pyAggr3g470r')
# Add administrative views here
class UserView(ModelView):
    column_filters = ['firstname', 'lastname']

    column_searchable_list = ('firstname', 'lastname')
class FeedView(ModelView):
    column_filters = ['title', 'link']

    column_searchable_list = ('title', 'link')
class ArticleView(ModelView):
    column_filters = ['title', 'link']

    column_searchable_list = ('title', 'link')
admin.add_view(FeedView(Feed))
admin.add_view(ArticleView(Article))
#admin.add_view(UserView(User))


from pyaggr3g470r import views
bgstack15