From 2e04caa4c91070eed219318f86bf1cb178500f4c Mon Sep 17 00:00:00 2001
From: Dominik George <nik@naturalnet.de>
Date: Thu, 5 Dec 2019 15:00:15 +0100
Subject: [PATCH] Really configure database.

---
 pytest_django_testing_postgresql.py | 9 ++++++---
 setup.py                            | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/pytest_django_testing_postgresql.py b/pytest_django_testing_postgresql.py
index 4838f37..3891336 100644
--- a/pytest_django_testing_postgresql.py
+++ b/pytest_django_testing_postgresql.py
@@ -1,4 +1,7 @@
-print('importing')
+from dj_database_url import parse
+from django.conf import settings
+from testing.postgresql import Postgresql
 
-def pytest_configure(config):
-    print('configuring')
+_postgresql = Postgresql()
+
+django.settings.DATABASES['default'] = parse(_postgresql.url())
diff --git a/setup.py b/setup.py
index b32d692..64e72e8 100644
--- a/setup.py
+++ b/setup.py
@@ -9,7 +9,7 @@ setup(
     url='https://edugit.org/nik/pytest-django-testing-postgresql',
 
     py_modules=['pytest_django_testing_postgresql'],
-    install_requires=['testing.postgresql'],
+    install_requires=['dj-database-url', 'testing.postgresql'],
 
     entry_points = {
         'pytest11': [
-- 
GitLab