Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'view' is not defined #28

Closed
fzorb opened this issue Nov 5, 2022 · 1 comment
Closed

NameError: name 'view' is not defined #28

fzorb opened this issue Nov 5, 2022 · 1 comment
Labels
doc Improvements or additions to documentation question Further information is requested

Comments

@fzorb
Copy link

fzorb commented Nov 5, 2022

Hi,
I have recently started working with mvc-flask, however, I unfortunately cannot seem to get view() to work. (view is undefined)

app/routes.py

from mvc_flask import Router

Router.get("/", "landing#route")

app/controllers/landing_controller.py

from flask import session

class LandingController:
    def route(self):
        return view("index.html")

app.py

from flask import Flask
from mvc_flask import FlaskMVC

app = Flask(__name__)
FlaskMVC(app)
@marcuxyz
Copy link
Owner

marcuxyz commented Nov 6, 2022

Sorry, I need update readme. You can use the render_template from flask module, instead view function.

from flask import session, render_template

class LandingController:
    def route(self):
        return render_template("index.html")

@marcuxyz marcuxyz added doc Improvements or additions to documentation question Further information is requested labels Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants