from random import choice, randrange, sample from string import ascii_letters, digits import requests import click from flask import current_app from flask.cli import FlaskGroup, run_command from maple import create_app from maple.blog.db import Article, Category, Tag, TimeLine from maple.extension import cache, db from maple.model import User from maple.storage.shell import Shell as StorageShell from werkzeug.contrib.fixers import ProxyFix app = create_app('config') app.wsgi_app = ProxyFix(app.wsgi_app) cli = FlaskGroup(add_default_commands=False, create_app=lambda r: app) cli.add_command(run_command) try: from flask_migrate import Migrate migrate = Migrate(app, db) except ImportError: pass DEFAULT_HOST = 'http://static.localhost:8001' DEFAULT_KEY = ''
# !/usr/bin/env python # -*- coding=UTF-8 -*- # ************************************************************************* # Copyright © 2015 JiangLin. All rights reserved. # File Name: run.py # Author:JiangLin # Mail:[email protected] # Created Time: 2016-02-07 09:12:47 # ************************************************************************* from maple import create_app from werkzeug.contrib.fixers import ProxyFix app = create_app() app.wsgi_app = ProxyFix(app.wsgi_app) if __name__ == '__main__': app.run()
# Mail:[email protected] # Created Time: 2016-02-11 13:34:38 # ************************************************************************* # !/usr/bin/env python # -*- coding: utf-8 -*- from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from maple import create_app from maple.extensions import db from maple.user.models import User from getpass import getpass from werkzeug.security import generate_password_hash from datetime import datetime import os app = create_app() migrate = Migrate(app, db) manager = Manager(app) @manager.command def runserver(): return app.run() @manager.option('-u', '--user_id', dest='user_id') def token(user_id): user_id = int(user_id) return User.query.get(user_id).token