Flask-Web-App-Tutorial icon indicating copy to clipboard operation
Flask-Web-App-Tutorial copied to clipboard

Invalid Syntax

Open programmer-Ayush opened this issue 3 years ago • 2 comments

When i type this for the main.py it shows invalid syntax when i run it from website import create_app

app = create_app()

if name == 'main': app.run(debug=True)

and when i type this for init.py it also shows invalid syntax when i run it from flask import Flask

def create_app(): app = Flask(name) app.config['SECRET_KEY'] = 'RJVA'

return app

Please suggest what to do. I have checked it with the code on GitHub it is the same still it shows invalid syntax.

programmer-Ayush avatar May 28 '21 12:05 programmer-Ayush

@programmer-Ayush

your mistake for the main.py is if name == 'main': you are not calling the __ before the name and after the name as well as for the main before and after

it is called if __name__ == '__main__': app.run(debug=True)

if this is not the fix then the other issue could be that you haven't select the right interpreter.

For my Mac i selected the Interpreter for Pyhton 3.9.5

TheGlorySaint avatar Jun 01 '21 14:06 TheGlorySaint

I have tried both of those things and yet it does not work I have a in valid syntax error

Opineda930 avatar Jun 11 '21 20:06 Opineda930