Beispiel #1
0
from flaskdemo.controller.demo import JsonTest, JsonData, UserView
from flaskdemo.controller.entity import createtable, add, delete, update
from flaskdemo.controller.font import Fontlist, Fontdetail, Logolist, Logodetail
from flaskdemo.controller.food import Foodlist, Fooddetail, Vegetablelist, Snacklist, Snackdetail, Souplist, Soupdetail
from flaskdemo.controller.index import ShowUsers
from flaskdemo.controller.love import AddLove, DelLove, FoodAddLove, FoodDelLove
from flaskdemo.controller.meat import Meatlist, Meatdetail, Meatslist, Meatsdetail, Dessertlist, Dessertdetail, \
    Noodleslist, Noodlesdetail
from flaskdemo.controller.pictrue import Pictruelist, Picturedetail, Palettelist, Palettedetail, Finishinglist, \
    Finishingdetail, Photographylist, Photographydetail, Illustrationlist, Illustrationdetail, Artistlist, Artistdetail, \
    Posterslist, Postersdetail
from flaskdemo.controller.test import Upload, Yulan, Multiple, EditerUplaod, Editor

BASE_DIR = os.path.abspath(os.path.dirname(__name__))

app = create_app()


def main():
    app.add_url_rule(rule='/upload/', view_func=Upload.as_view('upload'))
    app.add_url_rule(rule='/yulan/', view_func=Yulan.as_view('yulan'))
    app.add_url_rule(rule='/editerUplaod/',
                     view_func=EditerUplaod.as_view('editer'))
    app.add_url_rule(rule='/multiple/', view_func=Multiple.as_view('multiple'))

    app.add_url_rule(rule='/', view_func=ShowUsers.as_view('index'))
    app.add_url_rule(rule='/food/home/',
                     view_func=Foodlist.as_view('foodlist'))
    app.add_url_rule(rule='/food/meat/',
                     view_func=Meatlist.as_view('meatlist'))
    app.add_url_rule(rule='/food/meats/',
import os
from dotenv import load_dotenv
from flaskdemo import create_app

dotenv_path = os.path.join(os.path.dirname(__file__), '.flaskenv')
if os.path.exists(dotenv_path):
    load_dotenv(dotenv_path)

app = create_app('production')
Beispiel #3
0
def app():
    app = create_app({'TESTING': True})

    # TODO: database setup
    yield app
Beispiel #4
0
def test_config():
    assert not flaskdemo.create_app().testing
    assert flaskdemo.create_app({ 'TESTING': True }).testing
Beispiel #5
0
from flask_migrate import MigrateCommand
from flask_script import Manager

from celery_runner import make_celery
from flaskdemo import create_app

# def make_celery(app):
#     celery = Celery(app.import_name, broker=app.config['CELERY_BROKER_URL'])
#     celery.conf.update(app.config)
#     TaskBase = celery.Task
#     class ContextTask(TaskBase):
#         abstract = True
#         def __call__(self, *args, **kwargs):
#             with app.app_context():
#                 return TaskBase.__call__(self, *args, **kwargs)
#     celery.Task = ContextTask
#     return celery

app = create_app('develop')
manage = Manager(app=app)
celery = make_celery(app)
manage.add_command('db', MigrateCommand)

if __name__ == '__main__':
    manage.run()