Custom configuration path causing deployment error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pecan |
Invalid
|
Low
|
Ryan Petrello |
Bug Description
Following the documentation for deployment pecan framework with Apache+mod_wsgi :
https:/
This error comes in when you use your custom configuration file path.
code:
application = deploy(
It will complain about not able to find your application module. You are able to reproduce that in ipython ...
IPython 2.3.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: from pecan.deploy import deploy
In [2]: application = deploy(
-------
ImportError Traceback (most recent call last)
<ipython-
----> 1 application = deploy(
/opt/stack/
7 WSGI app.
8 """
----> 9 return load_app(config)
/opt/stack/
201 '''
202 from .configuration import _runtime_conf, set_config
--> 203 set_config(config, overwrite=True)
204
205 for package_name in getattr(
/opt/stack/
250
251 if isinstance(config, six.string_types):
--> 252 config = conf_from_
253 _runtime_
254 if config.__file__:
/opt/stack/
180 imp.load_module(
181 module_name,
--> 182 *imp.find_
183 )
184
ImportError: No module named myApp
This error won't show up if I switch it back to v0.8.2
Look into the 'configuration.py', it seems like the new code added in conf_from_file() is causing the issue ...
*imp.find_
The line above is not able to find my 'myApp'. The second argument limits the search path to 'basepath' which doesn't contain my application.
Pecan configuration files must be valid Python files, and must be importable. Change the file extension of your configuration file from ".conf" back to ".py" as the documentation suggests.