Hello Everybody,
I’m trying to put together Flask/python Config.py file and I’m not sure if its working or not. As you can see in the config.py ProdConfig class the debug is set to DEBUG=False. from the init.py its scripted as: app.config.from_object(‘config.ProdConfig’). But, in the terminal, it states “Debugger is active!”. is this mean the config file isn’t working or am I missing something?
No error message received.
What am i doing wrong?
config.py
from os import environ, path
from dotenv import load_dotenv
basedir = path.abspath(path.dirname(__file__))
load_dotenv(path.join(basedir, '.env'))
class Config:
#DEBUG=False
TESTING=False
class DevConfig(Config):
DEBUG = True
class ProdConfig(Config):
TESTING = False
DEBUG = False
init.py
import os
from flask import Flask, redirect, url_for
# from flask_sqlalchemy import SQLAlchemy
from config import Config
def create_app(app_config=None):
app = Flask(__name__, instance_relative_config=True)
app.config.from_object('config.ProdConfig')
return app
Results from the terminal
venv) PS D:\xampp\htdocs\flaskLearning> flask run
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
* Serving Flask app 'learning'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
* Restarting with stat
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
* Debugger is active!
* Debugger PIN: 366-622-259