天天看點

html顯示三維模型restful,傳回帶有Flask Restful的呈現模闆,在浏覽器中顯示HTML

我對Python和燒瓶還不熟悉。我在應用程式的根目錄中有一個模闆檔案夾,其中有兩個檔案。

{% block title %}{% endblock title %}

{# Navbar goes here. #}

{% block main %}{% endblock main %}

以及{% extends 'base.html' %}

{% block title %}Page Title{% endblock title %}

{% block main %}

This is a child template.

{% endblock main %}

然後我有以下功能from flask.ext.restful import Resource,request,reqparse

from app.business.login import Login

from app.business.appointments import Appointments

from app.models.models import User, Address,Appointment

from flask import render_template

class AppointmentController(Resource):

def __init__(self):

pass

def get(self):

return render_template('index.html')

是以當我啟動伺服器并說http://0.0.0.0:5000/appointment時"\n \n

\n Page Title\n \n \n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n\t

This is a child template.

\n\n \n \n\n"

這意味着模闆正在工作,但浏覽器将響應視為字元串而不是html。我做錯什麼了。