adding admin interface to existing pyramid app
Question: I'm trying to add a nice admin interface to an existing Pyramid project. I
created a test project using `pcreate -s alchemy -s pyramid_fa fa_test` and
then copied all the extra files created into my project and altered them to be
suitable.

Everything looks to be good and dandy until I try to add a formalchemy route:

    
    
    config.formalchemy_model("/foo", package='bar',
                             model='bar.models.specific_models.Thingy',
                             **settings)
    

Then I get: `ImportError: No module named forms`

**My question is:** How do I fix this? Or what is the correct way to add an
admin interface?

I've googled around a bunch to no avail...

Here's relevant code:

fainit.py:

    
    
    from bar import models, faforms
    import logging
    
    def includeme(config):
        config.include('pyramid_formalchemy')
        config.include('bar.fainit')
        config.include('fa.jquery')
        config.include('pyramid_fanstatic')
        model_view = 'fa.jquery.pyramid.ModelView'
        session_factory = 'bar.models.access.DBSession'
        ## register session and model_view for later use
        settings = {'package': 'bar',
                    'view': model_view,
                    'session_factory': session_factory,
                   }
        config.registry.settings['bar.fa_config'] = settings
    
        config.formalchemy_admin("/admin", models=models, forms=faforms,
                                 **settings)
    
        # Adding the package specific routes
        config.include('shop.faroutes')
        log.info('formalchemy_admin registered at /admin')
    

faroutes.py

    
    
    from bar import models
    import logging
    log = logging.getLogger(__name__)
    
    def includeme(config):
        settings = config.registry.settings.get('shop.fa_settings}}', {})
    
        config.formalchemy_model("/alerts", package='shop',
                                 model='shop.models.super_models.Alert',
                                 **settings)
    
        log.info('shop.faroutes loaded')
    

And the traceback:

    
    
    Starting subprocess with file monitor
    Traceback (most recent call last):
      File "../bin/pserve", line 9, in <module>
        load_entry_point('pyramid==1.5a1', 'console_scripts', 'pserve')()
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/pyramid-1.5a1-py2.7.egg/pyramid/scripts/pserve.py", line 51, in main
        return command.run()
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/pyramid-1.5a1-py2.7.egg/pyramid/scripts/pserve.py", line 316, in run
        global_conf=vars)
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/pyramid-1.5a1-py2.7.egg/pyramid/scripts/pserve.py", line 340, in loadapp
        return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 247, in loadapp
        return loadobj(APP, uri, name=name, **kw)
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 272, in loadobj
        return context.create()
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 710, in create
        return self.object_type.invoke(self)
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 146, in invoke
        return fix_call(context.object, context.global_conf, **context.local_conf)
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/util.py", line 56, in fix_call
        val = callable(*args, **kw)
      File "/home/sheena/WORK/tv_guys_env/shop/shop/__init__.py", line 30, in main
        includeme(config)
      File "/home/sheena/WORK/tv_guys_env/shop/shop/fainit.py", line 8, in includeme
        config.include('shop.fainit')
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/pyramid-1.5a1-py2.7.egg/pyramid/config/__init__.py", line 778, in include
        c(configurator)
      File "/home/sheena/WORK/tv_guys_env/shop/shop/fainit.py", line 24, in includeme
        config.include('shop.faroutes')
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/pyramid-1.5a1-py2.7.egg/pyramid/config/__init__.py", line 778, in include
        c(configurator)
      File "/home/sheena/WORK/tv_guys_env/shop/shop/faroutes.py", line 12, in includeme
        **settings)
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/pyramid-1.5a1-py2.7.egg/pyramid/util.py", line 507, in wrapper
        result = wrapped(self, *arg, **kw)
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/pyramid_formalchemy-0.4.4-py2.7.egg/pyramid_formalchemy/__init__.py", line 58, in formalchemy_model
        view=view, models=[model], model=model, **kwargs)
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/pyramid_formalchemy-0.4.4-py2.7.egg/pyramid_formalchemy/__init__.py", line 85, in formalchemy_admin
        forms = config.maybe_dotted('%s.forms' % package)
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/pyramid-1.5a1-py2.7.egg/pyramid/config/__init__.py", line 848, in maybe_dotted
        return self.name_resolver.maybe_resolve(dotted)
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/pyramid-1.5a1-py2.7.egg/pyramid/path.py", line 316, in maybe_resolve
        return self._resolve(dotted, package)
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/pyramid-1.5a1-py2.7.egg/pyramid/path.py", line 323, in _resolve
        return self._zope_dottedname_style(dotted, package)
      File "/home/sheena/WORK/tv_guys_env/local/lib/python2.7/site-packages/pyramid-1.5a1-py2.7.egg/pyramid/path.py", line 372, in _zope_dottedname_style
        __import__(used)
    ImportError: No module named forms
    


Answer: It sounds like it's looking for you to create a forms module at
`shop.faroutes.forms`.

