Exemple #1
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@Time:   2019/5/27 14:49
@Author: quanbin_zhu
@Email:  [email protected]
"""

import os

from app.app import app
from app.config.config import mockConfig
from app.scheduler.tasks import scheduler
from app.store.sqlitedb import db

from app.controller.main_controller import recover_controller

if __name__ == '__main__':
    db.create_all()
    scheduler.init_app(app)
    scheduler.start()
    host = mockConfig["mock-service"]["host"]
    port = os.environ["APP_PORT"] if "APP_PORT" in os.environ else mockConfig[
        "mock-service"]["port"]
    app.register_blueprint(recover_controller)
    app.run(host=host if host else "127.0.0.1", port=port if port else 5000)
Exemple #2
0
from app.app import app

from flask import redirect, url_for, request,render_template,jsonify,make_response

from .route_user import user_app
from .route_file import file_app
from .route_goods import goods_app


# 首页
@app.route('/')
def index():
    pass

# 测试
@app.route('/test',methods=['GET','POST'])
def test():
    pass



app.register_blueprint(user_app, url_prefix='/user')
app.register_blueprint(file_app, url_prefix='/file')
app.register_blueprint(goods_app, url_prefix='/goods')






Exemple #3
0
from app.app import app
from app.route.route_sharing import sharing
from app.route.route_search import search
from app.route.route_user import user
from flask import Blueprint, request
from app.service.index_interface import *
import json

# 构建蓝图
app.register_blueprint(sharing, url_prefix='/sharing')
app.register_blueprint(search, url_prefix='/search')
app.register_blueprint(user, url_prefix='/user')


#网站主页路由
@app.route('/index', methods=['POST'])
def index():
    if request.is_json and request.get_json():
        u = request.get_json()
        # 量身推荐接口
        if u['skinid']:
            res = recommended_Volume(u)
            return json.dumps(res)
        # 热门动态
        elif u['hot_thing']:
            res = hot_Dynamic()
            return json.dumps(res)
        # 测评资讯
        elif u['evaluation_information']:
            res = evaluation_Information()
            return json.dumps(res)
Exemple #4
0
from app.route_user import user
from app.route_order import orders
from app.route_detail import detail
from app.route_myorder import myorder
from app.route_mydetails import my_details
from app.route_personaldate import personalDate
from app.route_collection import my_collection
from app.route_comment import comment
from app.route_purchaser import purchaser
from app.route_safety import safety
from app.route_index import index
from app.route_search import search
from app.route_sceipe import sceipe

# 构建蓝图
app.register_blueprint(index, url_prefix='/api/index')
app.register_blueprint(user, url_prefix='/api/user')
app.register_blueprint(orders, url_prefix='/api/orders')
app.register_blueprint(detail, url_prefix='/api/detail')
app.register_blueprint(myorder, url_prefix='/api/myorder')
app.register_blueprint(my_details, url_prefix='/api/my_details')
app.register_blueprint(personalDate, url_prefix='/api/personalDate')
app.register_blueprint(my_collection, url_prefix='/api/my_collection')
app.register_blueprint(comment, url_prefix='/api/comment')
app.register_blueprint(purchaser, url_prefix='/api/purchaser')
app.register_blueprint(safety, url_prefix='/api/safety')
app.register_blueprint(search, url_prefix='/api/search')
app.register_blueprint(sceipe, url_prefix='/api/sceipe')


@app.route('/api/v1')
Exemple #5
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @desc  : Created by San on 2018-06-18 08:59
# @site  : https://github.com/SunmoonSan
from app.app import app
from app.ask import ask
from app.auth import auth
from app.auth.models import User
from app.extensions import login_manager


def config_login(app):
    login_manager.login_view = 'ask.index'
    login_manager.refresh_view = 'ask.index'
    login_manager.login_message = '请先登录!'
    login_manager.session_protection = 'basic'
    login_manager.init_app(app=app)

    @login_manager.user_loader
    def load_user(id):
        return User.query.get(id)

    login_manager.setup_app(app)


app.register_blueprint(ask)
app.register_blueprint(auth)
config_login(app)
from .route_sendResume import sendResume_app
'''
# 1. 导入request对象
# 2. request method
    get: 是一种提交数据的方式,这种方式显著的特点是不安全但效率高,提交数据简单
    post: 是一种提交数据的方式,这种方式显著的特点是安全但效率不高,提交数据复杂
'''


# 渲染引擎
@app.route('/')
def index():
    return render_template('index.html')


app.register_blueprint(user_app, url_prefix='/user')
app.register_blueprint(resume_app, url_prefix='/resume')
app.register_blueprint(search_app, url_prefix='/search')
app.register_blueprint(sendResume_app, url_prefix='/sendResume')


# success 200
# not found 404
# error 500
@app.errorhandler(404)
def miss(e):
    return '404'


@app.errorhandler(500)
def error(e):
Exemple #7
0
from app.app import app, db_wrapper
from stock import views, models
from admin.endpoints import admin

db_wrapper.init_app(app)
admin.init_app(app)
app.register_blueprint(views.stock_endpoints)

# pipenv run flask run


def create_db(db):
    with db:
        db.create_tables([
            models.Product,
        ])


if __name__ == "__main__":
    create_db(db_wrapper.database)
Exemple #8
0
from app.app import app
from flask import redirect, url_for, request, render_template

from .route_user import user_app

# 注册route_user蓝图
app.register_blueprint(user_app, url_prefix='/userapp')
# 首页
@app.route('/')
def index():
    return render_template("index.html")