1
0
mirror of https://github.com/ilri/dspace-statistics-api.git synced 2024-11-25 07:40:17 +01:00

Refactor project structure

This follows guidance from several well-known Python best practices
guides. Basically, the idea is create a package for the application
that is comprised of several re-usable modules.

See: https://docs.python-guide.org/writing/structure/
See: https://realpython.com/python-application-layouts/
This commit is contained in:
Alan Orth 2018-10-26 18:14:27 +02:00
parent 754663f062
commit c027f01b48
7 changed files with 10 additions and 10 deletions

View File

@ -24,11 +24,11 @@ Set up the environment variables for Solr and PostgreSQL:
Index the Solr statistics core to populate the PostgreSQL database:
$ ./indexer.py
$ python -m dspace_statistics_api.indexer
Run the REST API:
$ gunicorn app:api
$ gunicorn dspace_statistics_api.app:api
Test to see if there are any statistics:

View File

View File

@ -1,4 +1,4 @@
from database import database_connection
from .database import database_connection
import falcon
db = database_connection()

View File

@ -1,7 +1,7 @@
from config import DATABASE_NAME
from config import DATABASE_USER
from config import DATABASE_PASS
from config import DATABASE_HOST
from .config import DATABASE_NAME
from .config import DATABASE_USER
from .config import DATABASE_PASS
from .config import DATABASE_HOST
import psycopg2, psycopg2.extras
def database_connection():

View File

@ -30,10 +30,10 @@
# See: https://solrclient.readthedocs.io/en/latest/SolrClient.html
# See: https://wiki.duraspace.org/display/DSPACE/Solr
from database import database_connection
from .database import database_connection
import json
import psycopg2.extras
from solr import solr_connection
from .solr import solr_connection
def index_views():
# get total number of distinct facets for items with a minimum of 1 view,

View File

@ -1,4 +1,4 @@
from config import SOLR_SERVER
from .config import SOLR_SERVER
from SolrClient import SolrClient
def solr_connection():