dimanche 20 septembre 2020

How can I solve django TypeError: __init__() got an unexpected keyword argument 'thread critical' error in gitlab-ci?

I have a Django project and I am using gitlab-ci for it but my tests failed!

I used to use bitbucket-ci before and I had no problem.

My .gitlab-ci.yml file is:

image: python:latest

services:
  - postgres:latest

variables:
  POSTGRES_DB: ci
  POSTGRES_USER: postgres
  POSTGRES_PASSWORD: 123456

cache:
  paths:
    - ~/.cache/pip/


before_script:
  - python -V  # Print out python version for debugging
  - pip install -r requirements.txt

test:
  variables:
    DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB"
  script:
    - python manage.py test --settings sohbat_backend.ci_settings

but I get this error that I have never seen anywhere!

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 10, in main
    from django.core.management import execute_from_command_line
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 14, in <module>
    from django.core.management.base import (
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 11, in <module>
    from django.core import checks
  File "/usr/local/lib/python3.8/site-packages/django/core/checks/__init__.py", line 10, in <module>
    import django.core.checks.database  # NOQA isort:skip
  File "/usr/local/lib/python3.8/site-packages/django/core/checks/database.py", line 1, in <module>
    from django.db import connections
  File "/usr/local/lib/python3.8/site-packages/django/db/__init__.py", line 16, in <module>
    connections = ConnectionHandler()
  File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 148, in __init__
    self._connections = Local(thread_critical=True)
TypeError: __init__() got an unexpected keyword argument 'thread_critical'

Aucun commentaire:

Enregistrer un commentaire