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

Unable to load configuration file in python flask

$
0
0

Some variables had to be moved from the main server.py in to a configuration file called config.py.

Its contents are something like this:

class Config(object):   #All the settings and variables go here

In server.py, in invoke this file with:

app = Flask(__name__)app.config.from_object("config.py")

However, i get this error:

werkzeug.utils.ImportStringError: import_string() failed for 'config.py'. Possible reasons are:- missing __init__.py in a package;- package or module path not included in sys.path;- duplicated package or module name taking precedence in sys.path;- missing module, class, function or variable;Debugged import:- 'config' found in '/mnt/io_files/config.py'.- 'config.py' not found.Original exception:ImportError: module 'config' has no attribute 'py'

I don't know what to do in order to properly invoke this file. In the same directory, i do have a __init__.py file.


Viewing all articles
Browse latest Browse all 5054

Trending Articles



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