天天看点

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。我做错什么了。