Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5054

flask environment ignored in config.py

$
0
0

I'm trying to build a basic flask app for learning purposes. everything flows smoothly, but there's an issue I don't understand. in my run.py file, I have the following line:

app.config.from_object('config.prodConfig')

this loads config.py in the root, whitch contains the following code:

class Config:SECRET_KEY = '1234567890'STATIC_FOLDER = 'static'TEMPLATES_FOLDER = 'templates'class devConfig(Config):FLASK_ENV = 'development'DEBUG = TrueTESTING = Trueclass prodConfig(Config):FLASK_ENV = 'production'DEBUG = FalseTESTING = False

my understanding is that Config contains a few "default" settings. devConfig and prodConfig are based on Config, so will always contain those values, but each will have different env, debug and testing value. though I don't get any errors and debug seems to be activated, when I run my instance of Flask it tells me I'm running in production, regardless of what I do.

 * Serving Flask app "run" (lazy loading) * Environment: production   WARNING: This is a development server. Do not use it in a production deployment.   Use a production WSGI server instead. * Debug mode: on * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) * Restarting with stat * Debugger is active!

I'm not interested in setting the env variable in the terminal/environment, I know how to do that. what I'm interested in is why this doesn't work. after all, the FLASK_ENV directive is a valid one and it should load when instructed to.

what am I doing wrong?


Viewing all articles
Browse latest Browse all 5054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>