Custom configuration path causing deployment error

Bug #1413032 reported by Kent Wu
6
This bug affects 1 person
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://pecan.readthedocs.org/en/latest/deployment.html#deployment

This error comes in when you use your custom configuration file path.

code:
application = deploy('your/custom/conf/path')

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('/etc/myApp/myApp.conf')
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-f49421abb8e4> in <module>()
----> 1 application = deploy('/etc/myApp/myApp.conf')

/opt/stack/venv/local/lib/python2.7/site-packages/pecan/deploy.pyc in deploy(config)
      7 WSGI app.
      8 """
----> 9 return load_app(config)

/opt/stack/venv/local/lib/python2.7/site-packages/pecan/core.pyc in load_app(config, **kwargs)
    201 '''
    202 from .configuration import _runtime_conf, set_config
--> 203 set_config(config, overwrite=True)
    204
    205 for package_name in getattr(_runtime_conf.app, 'modules', []):

/opt/stack/venv/local/lib/python2.7/site-packages/pecan/configuration.pyc in set_config(config, overwrite)
    250
    251 if isinstance(config, six.string_types):
--> 252 config = conf_from_file(config)
    253 _runtime_conf.update(config)
    254 if config.__file__:

/opt/stack/venv/local/lib/python2.7/site-packages/pecan/configuration.pyc in conf_from_file(filepath)
    180 imp.load_module(
    181 module_name,
--> 182 *imp.find_module(module_name, [basepath])
    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_module(module_name, [basepath])

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.

Revision history for this message
Ryan Petrello (ryan-petrello) wrote :

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.

Changed in pecan:
status: New → Invalid
assignee: nobody → Ryan Petrello (ryan-petrello)
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.