Have this perfectly running on my local PC but Im unable to make it run here.
wsgi.pt:
from main import app as application
main.py:
from website import create_app
app = create_app()
initi.py (under website):
from dotenv import load_dotenv
from flask_migrate import Migrate
......
db = SQLAlchemy()
image_folder= os.getenv("UPLOAD_FOLDER")
ALLOWED_EXTENSIONS = os.getenv("ALLOWED_EXTENSIONS")
load_dotenv()
def create_app():
app = Flask(__name__)
app.config['SECRET_KEY'] = os.getenv("APP_SECRET_KEY")
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv("DATABASE_URL")
db.init_app(app)
migrate = Migrate(app, db)
from .views import views
from .auth import auth
app.register_blueprint(views, url_prefix='/')
app.register_blueprint(auth, url_prefix='/')
get error on my log:
2023-02-11 14:09:23,405: Error running WSGI application 2023-02-11 14:09:23,406: RuntimeError: Either 'SQLALCHEMY_DATABASE_URI' or 'SQLALCHEMY_BINDS' must be set. 2023-02-11 14:09:23,406: File "/var/www/...._pythonanywhere_com_wsgi.py", line 16, in <module> 2023-02-11 14:09:23,407: from main import app as application # noqa 2023-02-11 14:09:23,407: 2023-02-11 14:09:23,407: File "/home/.../main.py", line 3, in <module> 2023-02-11 14:09:23,407: app = create_app() 2023-02-11 14:09:23,407: 2023-02-11 14:09:23,408: File "/home/.../website/init.py", line 21, in create_app 2023-02-11 14:09:23,408: db.init_app(app) 2023-02-11 14:09:23,408: 2023-02-11 14:09:23,408: File "/home/.../venv/lib/python3.10/site-packages/flask_sqlalchemy/extension.py", line 307, in init_app 2023-02-11 14:09:23,408: raise RuntimeError(
Any help is appreciated.
Many thanks