user6923096
user6923096

Reputation: 33

Python- pyramid doesn't run local host

I am trying to install and run python pyramid.

I installed anaconda, created a virtual environment and used pip install "pyramid==1.7.3" to install pyramid.

Then executed

   `from wsgiref.simple_server import make_server
    from pyramid.config import Configurator
    from pyramid.response import Response


    def hello_world(request):
        return Response('Hello %(name)s!' % request.matchdict)

    if __name__ == '__main__':
        config = Configurator()
        config.add_route('hello', '/hello/{name}')
        config.add_view(hello_world, route_name='hello')
        app = config.make_wsgi_app()
        server = make_server('0.0.0.0', 8080, app)
        server.serve_forever()`

this helloworld.py. This doesn't start the server and when I open the localhost:8080 in the browser, it gave me a 404 Not Found The resource could not be found. Error.

here is the Command Prompt

What am I missing here?

Upvotes: 2

Views: 328

Answers (2)

user6923096
user6923096

Reputation: 33

It was serving at ' http://localhost:8080/hello/world ' not in the 'localhost:8080'

Upvotes: 1

Steve Piercy
Steve Piercy

Reputation: 15045

For newbies to web application development in Python, I recommend working through the Quick Tutorial. Do not skip over any steps, including Requirements. It provides a good overview of creating web applications in Python and its ecosystem, with references for further in-depth reading.

Anaconda is targeted toward the data science audience. In our documentation, we don't provide specific instructions for how to work within Anaconda, so you would have to learn that part on your own.

Upvotes: 1

Related Questions