I'm new to Flask. I was wondering if I can separate code to a different module in Flask (I know Blueprint can do that). So I tried to separate code like this:
Flask-Project
-- app.py
-- login.py
and here is app.py code:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()
and in login.py:
from app import app
@app.route('/login')
def login():
return 'login'
when I run this Flask project,I try http://127.0.0.0:5000/login, it shows:
Not Found
The requested URL was not found on the server.
If you entered the URL manually please check your spelling and try again.
Why does http://127.0.0.0:5000/login not work?