flask-mega-tutorial and I found some error when I execute my code. first I have init.py
from flask import Flask
app = Flask(__name__)
from app import routes
then routes.py
from app import app
@app.route('/')
@app.route('/index')
def index():
return "Hello, World!"
And last I have microblog.py to execute my code
from app import app
app.run(debug=True)
but when I execute FLASK_APP = microblog.py then flask run, I found this
- Serving Flask app "microblog.py"
- Environment: production WARNING: Do not use the development server in a production environment. Use a production WSGI server instead.
- Debug mode: off Usage: flask run [OPTIONS]
Error: While importing "microblog", an ImportError was raised:
Traceback (most recent call last): File "e:\skripsiku\flask\lib\site-packages\flask\cli.py", line 235, in locate_app import(module_name) File "E:\skripsiku\microblog.py", line 1, in from app import app ImportError: cannot import name 'app'
Oh and lastly there is my folder structure. I have main folder named skripsiku then in there I have app folder (in : init.py, routes.py) and microblog.py. Can anyone help me? thank you
