I am trying to run a simple hello world example in python that runs against mongodb. I’ve set up mongo, bottle and pymong and have the following script inside C:\Python27\Scripts:
import bottle
import pymongo
@bottle.route('/')
def index()
from pymongo import Connection
connection = Connection('localhost', 27017)
db = connection.test
names = db.names
item = names.find_one()
return '<b>Hello %s!</b>' % item['name']
bottle.run(host='localhost', port=8082)
-!-- hello.py All L8 (Python)
I want to run this locally and I go to http://localhost:8082 but I get not found not found. How can I run that code to test it locally on my computer so I can test the code via the browser. I am running Windows 7 and have WAMP installed.
1) Add
:after function name:2) WAMP does not include MongoDB. You need to install Mongodb locally as well.
3) If something doesn’t work, then you generally should be looking console for errors.