Flask-Web-App-Tutorial
Flask-Web-App-Tutorial copied to clipboard
Invalid Syntax
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
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
I have tried both of those things and yet it does not work I have a in valid syntax error