This commit is contained in:
zhangwenwen 2021-08-10 15:41:22 +08:00
parent 44d8561ed0
commit 9ad821a28e
5 changed files with 35 additions and 3 deletions

View File

@ -1,8 +1,11 @@
from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from flask_moment import Moment
from flask import Flask
from config import config
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(config[config_name])
from .main import main as main_blueprint
app.register_blueprint(main_blueprint)
return app

View File

@ -1,3 +1,5 @@
from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors

0
app/main/errors.py Normal file
View File

7
app/main/views.py Normal file
View File

@ -0,0 +1,7 @@
from . import main
import json
@main.route('/', methods=['GET', 'POST'])
def index():
return json.dumps({'Message': 'Hello, world'})

View File

@ -0,0 +1,20 @@
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
DEBUG = True
config = {
'development': DevelopmentConfig,
'default': DevelopmentConfig
}