I'm using pythonanywhere to host as it seemed to be the most straight forward but having some issues Where am I meant to app.run()
When I try and import it into wsgi.py without using app.run() in my init.py file The wsgi.py file errors out with:
ImportError: cannot import name 'app' from 'init' (/home/g4t0/g4t0-flask/init.py)
But if I have app.run() it within the init.py file
it starts the dev webserver (rather than the prod wsgi one I want it to)
Where is the command app.run() meant to be? If anywhere? & if it's not meant to ran, then how do I configure wsgi.py to properly import the app?
from flask import Flask, render_template, session, url_for
from dotenv import load_dotenv
import os
load_dotenv()
secret_key = os.getenv('secret_key')
def init_app():
app = Flask(__name__)
## generate a secret using secret module
app.config['SECRET_KEY'] = f'{secret_key}'
# blueprint for auth routes in our app
from auth import auth as auth_blueprint
app.register_blueprint(auth_blueprint)
# blueprint for non-auth parts of app
from main import main as main_blueprint
app.register_blueprint(main_blueprint)
# blueprint for admin
from admin import admin as admin_blueprint
app.register_blueprint(admin_blueprint)
return app
if __name__ == "__main__":
app = init_app()