Skip to content

Commit

Permalink
Programming works better when the programmer isn't stupid
Browse files Browse the repository at this point in the history
(that's me. I'm the stupid)
  • Loading branch information
ewjoachim committed Feb 28, 2024
1 parent 201dd4b commit 36da94d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions procrastinate/contrib/django/django_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from django.db.backends.base.base import BaseDatabaseWrapper
from typing_extensions import LiteralString

from procrastinate import connector, psycopg_connector
from procrastinate.contrib.aiopg import aiopg_connector
from procrastinate import connector
from procrastinate.contrib.django import utils

if TYPE_CHECKING:
Expand Down Expand Up @@ -129,10 +128,14 @@ def get_worker_connector(self) -> connector.BaseAsyncConnector:
alias = utils.get_setting("DATABASE_ALIAS", default="default")

if utils.package_is_installed("psycopg3"):
from procrastinate import psycopg_connector

return psycopg_connector.PsycopgConnector(
kwargs=utils.connector_params(alias)
)
if utils.package_is_installed("aiopg"):
from procrastinate.contrib.aiopg import aiopg_connector

return aiopg_connector.AiopgConnector(**utils.connector_params(alias))

raise django_exceptions.ImproperlyConfigured(
Expand Down

0 comments on commit 36da94d

Please # to comment.