示例#1
0
from gitmostwanted.app import app
from gitmostwanted.blueprints import\
    user_oauth, user_profile, user_attitude, repo_rating, repo_trending

app.register_blueprint(user_oauth.user_oauth)
app.register_blueprint(repo_trending.repo_trending)
app.register_blueprint(repo_rating.repo_rating)
app.register_blueprint(user_attitude.user_attitude)
app.register_blueprint(user_profile.user_profile)

app.jinja_env.add_extension('jinja2.ext.do')

if __name__ == '__main__':
    app.run(host='0.0.0.0')
示例#2
0
from gitmostwanted.app import app
from gitmostwanted.lib.filter import number_humanize
from gitmostwanted.blueprints import\
    user_oauth, user_profile, user_attitude, repo_rating, repo_trending

app.register_blueprint(user_oauth.user_oauth)
app.register_blueprint(repo_trending.repo_trending)
app.register_blueprint(repo_rating.repo_rating)
app.register_blueprint(user_attitude.user_attitude)
app.register_blueprint(user_profile.user_profile)

app.jinja_env.filters['number_humanize'] = number_humanize
app.jinja_env.add_extension('jinja2.ext.do')

if __name__ == '__main__':
    app.run(host='0.0.0.0')
示例#3
0
from flask import g, render_template, redirect, request, session, url_for
from gitmostwanted.blueprints.user_attitude import user_attitude
from gitmostwanted.services import oauth as service_oauth
from gitmostwanted.models.user import User, UserAttitude
from gitmostwanted.models.repo import Repo
from gitmostwanted.models import report
from gitmostwanted.app import app, db


app.register_blueprint(user_attitude)
app.jinja_env.add_extension('jinja2.ext.do')

oauth = service_oauth.instance(app)


@app.route('/', defaults={'rng': 'day'})
@app.route('/trending/<rng>/')
def index(rng):
    map_list = {'day': 'ReportAllDaily', 'week': 'ReportAllWeekly', 'month': 'ReportAllMonthly'}
    if rng not in map_list:
        rng = 'day'

    model = getattr(report, map_list[rng])

    if not g.user:
        q = model.query.join(Repo).add_columns(db.null())
    else:
        q = model.query\
            .join(Repo)\
            .add_columns(UserAttitude.attitude)\
            .outerjoin(
示例#4
0
from gitmostwanted.app import app
from gitmostwanted.blueprints import \
    repo_rating, repo_trending, repo_information, static_content, user_attitude, user_oauth, \
    user_profile
from gitmostwanted.lib.filter import number_humanize

app.register_blueprint(repo_information.repo_information)
app.register_blueprint(repo_rating.repo_rating)
app.register_blueprint(repo_trending.repo_trending)
app.register_blueprint(static_content.static_content)
app.register_blueprint(user_attitude.user_attitude)
app.register_blueprint(user_oauth.user_oauth)
app.register_blueprint(user_profile.user_profile)

app.jinja_env.filters['number_humanize'] = number_humanize
app.jinja_env.add_extension('jinja2.ext.do')

if __name__ == '__main__':
    app.run(host='0.0.0.0')