1
0
mirror of https://github.com/ilri/dspace-statistics-api.git synced 2025-05-08 06:06:01 +02: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:
2018-10-26 18:14:27 +02:00
parent 754663f062
commit c027f01b48
7 changed files with 10 additions and 10 deletions

View File

@ -0,0 +1,12 @@
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():
connection = psycopg2.connect("dbname={} user={} password={} host='{}'".format(DATABASE_NAME, DATABASE_USER, DATABASE_PASS, DATABASE_HOST), cursor_factory=psycopg2.extras.DictCursor)
return connection
# vim: set sw=4 ts=4 expandtab: