Hi, I'm having problems with basic views import. No matter how I try to import views ("import views", "from views import ", "import * from views") I get an error: "from views import " used. unable to detect undefined names "views.*". imported but unused.
On my website there's an error 404: Not Found. The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
What do I do wrong?
My code:
main.py
from flask import Flask
app = Flask(__name__)
if __name__ == '__main__':
from views import *
app.run()
views.py
from main import app
@app.route('/', methods=['GET'])
def info():
return 'hello'
It works when I change main.py to:
from flask import Flask
app = Flask(__name__)
@app.route('/', methods=['GET'])
def info():
return 'hello'
if __name__ == '__main__':
app.run()