目录结构
步骤
在admin的__init__.py中:
from flask import Blueprint
admin = Blueprint('admin',__name__)
from app.admin import views
admin的views.py中(主要存放视图函数):
from . import admin
@admin.route('/')
def index():
return ''this is admin
在app的__init__.py中:
from flask import Flask
app = Flask(__name__)
app.debug = True
from app.admin import admin as admin_bp
app.register_blueprint(admin_bp,url_prefix='/admin')
manage.py中:
from app import app
if __name__=='main':
app.run()
config.py中(和manage.py在同级):
secret_key = 'usda781qsyt562wsd0okmh'