项目框架:
.
├── cart.py
├── gooods.py
├── main.py
└── user.py
main.py
from flask import Flask
from goods import get_goods
from user import register
from cart import get_cart
app = Flask(__name__)
app.route('/get_goods')(get_goods)
app.route('/get_cart')(get_cart)
app.route('/user')(register)
@app.route('/index', methods=['GET', 'POST'])
def index():
return 'index page'
if __name__ == '__main__':
app.run()
user.py
def register():
return 'register page'
cart.py
def get_cart():
return 'cart page'
goods.py
def get_goods():
return 'goods page'