2018-10-26 18:14:27 +02:00
|
|
|
from .config import DATABASE_NAME
|
|
|
|
from .config import DATABASE_USER
|
|
|
|
from .config import DATABASE_PASS
|
|
|
|
from .config import DATABASE_HOST
|
2018-11-03 21:40:45 +01:00
|
|
|
from .config import DATABASE_PORT
|
2018-09-26 21:23:24 +02:00
|
|
|
import psycopg2, psycopg2.extras
|
2018-09-24 23:49:47 +02:00
|
|
|
|
|
|
|
def database_connection():
|
2018-11-03 21:40:45 +01:00
|
|
|
connection = psycopg2.connect("dbname={} user={} password={} host='{}' port={}".format(DATABASE_NAME, DATABASE_USER, DATABASE_PASS, DATABASE_HOST, DATABASE_PORT), cursor_factory=psycopg2.extras.DictCursor)
|
2018-09-23 23:00:05 +02:00
|
|
|
|
|
|
|
return connection
|
|
|
|
|
2018-09-23 15:47:00 +02:00
|
|
|
# vim: set sw=4 ts=4 expandtab:
|