I was following the example here: https://github.com/pyeve/eve-demo/blob/master/settings.py
When I go to localhost:5000/apps, I can see all the documents in my collection, but when I search for an email at localhost:5000/apps/example@gmail.com, it says '404 not found'.
I've confirmed the regex, and the email addresses are in the documents. Can anyone see what might be wrong?
run.py
from eve import Eve
if __name__ == '__main__':
app = Eve()
app.run()
settings.py:
RESOURCE_METHODS = ['GET', 'POST', 'DELETE']
ITEM_METHODS = ['GET', 'PATCH', 'PUT', 'DELETE']
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
MONGO_DBNAME = 'test_database'
apps = {
'item_title' : 'app',
'additional_lookup' : {
'url' : 'regex("\b[\w.-]+?@\w+?\.\w+?\b")',
'field' : 'developer_email',
},
'schema': {
'address' : {
'type' : 'string'
},
'developer_email' : {
'type' : 'string',
'minlength' : 1,
'maxlength' : 15,
'required' : True,
'unique' : True,
}
}
DOMAIN = {
'apps' : apps,
}
You can't add more than one additional lookup to the same endpoint. What you can do however, is have multiple endpoints consuming the same datasource. By default standard item entry point is defined as /apps/'objectID'/. You will have to configure another endpoint to /apps/'new endpoint'. Python-Eve: More than one additional lookup
In your settings.py you aren't doing the lookup correctly. It should be.