コード例 #1
0
from functools import wraps
import datetime
from logging import getLogger

from flask import render_template, request, url_for,\
    redirect, flash, make_response, Blueprint

from app.content.models import BlogPost, RecentPosts, Likes
from app.views.wtforms import BlogForm
from factory_app import create_app
from models.exceptions import NotFound, ValidationError

logger = getLogger(__name__)
recent_posts = RecentPosts()

app = create_app()
with app.app_context():
    from authentication import *


@app.route('/hello_world')
@login_required
def hello_world():
    return render_template('hello_world.html')


@app.route('/index')
def index():
    return 'User is updated'

コード例 #2
0
'''
Flask를 실행할 프로그램
factory_app로부터 app의 반환값을 받아서 실행한다
'''
import os
from factory_app import create_app

app = create_app('dev')  # chose test, dev, pro

if __name__ == '__main__':
    # flask_path설정은 app.py일 경우 해주지 않아도 된다
    app.run(port='5000', host='0.0.0.0')
コード例 #3
0
ファイル: test_app.py プロジェクト: anzairyo0127/flask-mvc
from factory_app import create_app

app = create_app('test')
client = app.test_client()


def test_config():

    assert app.config['SQL_ADDRESS'] in client.get('/').data.decode('utf8')