mirror of
https://github.com/ilri/dspace-statistics-api.git
synced 2024-11-22 14:25:01 +01:00
app.py: Don't initialize Solr connection
We only need Solr in the indexing component, not for the API itself.
This commit is contained in:
parent
568ff2eebb
commit
963aa245c8
5
app.py
5
app.py
@ -1,10 +1,8 @@
|
|||||||
from database import database_connection
|
from database import database_connection
|
||||||
import falcon
|
import falcon
|
||||||
from solr import solr_connection
|
|
||||||
|
|
||||||
db = database_connection()
|
db = database_connection()
|
||||||
db.set_session(readonly=True)
|
db.set_session(readonly=True)
|
||||||
solr = solr_connection()
|
|
||||||
|
|
||||||
class AllItemsResource:
|
class AllItemsResource:
|
||||||
def on_get(self, req, resp):
|
def on_get(self, req, resp):
|
||||||
@ -65,6 +63,9 @@ class ItemResource:
|
|||||||
|
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
|
def on_exit(api):
|
||||||
|
print("Shutting down DB")
|
||||||
|
|
||||||
api = falcon.API()
|
api = falcon.API()
|
||||||
api.add_route('/items', AllItemsResource())
|
api.add_route('/items', AllItemsResource())
|
||||||
api.add_route('/item/{item_id:int}', ItemResource())
|
api.add_route('/item/{item_id:int}', ItemResource())
|
||||||
|
Loading…
Reference in New Issue
Block a user