Configurator Scan not picking up views
- by mxmissile
New to Py and Python. I'm trying to get pyramid Configurator scan to find my views, but I seem to be missing something, it's not picking up my "view" index here are my files:
app.py
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
if __name__ == '__main__':
config = Configurator()
config.add_route('home', '/')
config.scan()
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
server.serve_forever()
and index.py
from pyramid.view import view_config
from pyramid.response import Response
@view_config(route_name='home')
def index(request):
print'Incoming request'
return Response('<body><h1>Home</h1></body>')
Its returning a 404. However, if I remove config.scan() and add the view manually it works fine.
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from index import index
if __name__ == '__main__':
config = Configurator()
config.add_route('home', '/')
config.add_view(index, route_name='home')