python - ImportError: No module named config on Travis-CI build -


i'm having import error on travis builds, error related configuration of flask:

from flask import flask  app = flask(__name__) app.config.from_object('config') 

on local machine, flask app run correctly. on travis here error trace

$ nosetests --with-coverage --cover-package=core e......................... ====================================================================== error: failure: importstringerror (import_string() failed 'config'. possible reasons are: - missing __init__.py in 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' not found. original exception: importerror: no module named config) ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/nose/loader.py", line 414, in loadtestsfromname addr.filename, addr.module)   file "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/nose/importer.py", line 47, in importfrompath return self.importfromdir(dir_path, fqname)   file "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/nose/importer.py", line 94, in importfromdir mod = load_module(part_fqname, fh, filename, desc)   file "/home/travis/build/dzlab/sentimentpy/webapp/app/__init__.py", line 6, in <module> app.config.from_object('config')   file "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/flask/config.py", line 162, in from_object obj = import_string(obj)   file "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/werkzeug/utils.py", line 426, in import_string sys.exc_info()[2])   file "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/werkzeug/utils.py", line 408, in import_string return __import__(import_name) importstringerror: import_string() failed 'config'. possible reasons are: - missing __init__.py in 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; 

what's wrong configuration?

import_string takes absolute module imports. since config not top-level module, part of webapp, need specify webapp.config. see http://flask.pocoo.org/docs/0.10/config/#configuring-from-files:

app = flask(__name__) app.config.from_object('yourapplication.default_settings') app.config.from_envvar('yourapplication_settings') 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -