我创建了一个简单的烧瓶休息应用程序,结构如下
flask-test
app
-main
-controller
-time_controller.py
-service
-time_service.py
__init__.py
manage.py
manage.py
from flask_script import Manager
from app.main import create_app
app = create_app()
app.app_context().push()
manager = Manager(app)
@manager.command
def run():
app.run()
if __name__ == '__main__':
manager.run()
time_controller.py
from flask import jsonify
from ..service.agg_service import get_time
from manage import app
@app.route("/", methods=['GET'])
def combined_result():
time = get_time()
return jsonify(time)
time_service.py
import time
def get_time():
return time.strftime("%Y%m%d-%H%M%S")
init.py
from flask import Flask
def create_app():
app = Flask(__name__)
return app
当我尝试使用 python manage.py runserver 运行时。我不断收到 404 Not Found。(在服务器上找不到请求的 URL。)。可能是什么问题?