python3Packages.django-cachalot: init at 2.5.3

This commit is contained in:
Raito Bezarius 2023-06-09 18:23:03 +02:00 committed by Jonas Heinrich
parent 9950021ce8
commit 8fb44a4928
3 changed files with 121 additions and 0 deletions

View File

@ -0,0 +1,54 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, django
, django-debug-toolbar
, psycopg2
, beautifulsoup4
, python
}:
buildPythonPackage rec {
pname = "django-cachalot";
version = "2.5.3";
format = "setuptools";
src = fetchFromGitHub {
owner = "noripyt";
repo = "django-cachalot";
rev = "v${version}";
hash = "sha256-ayAN+PgK3aIpt4R8aeC6c6mRGTnfObycmkoXPTjx4WI=";
};
patches = [
# Disable tests for unsupported caching and database types which would
# require additional running backends
./disable-unsupported-tests.patch
];
propagatedBuildInputs = [
django
];
checkInputs = [
beautifulsoup4
django-debug-toolbar
psycopg2
];
pythonImportsCheck = [ "cachalot" ];
checkPhase = ''
runHook preCheck
${python.interpreter} runtests.py
runHook postCheck
'';
meta = with lib; {
description = "No effort, no worry, maximum performance";
homepage = "https://github.com/noripyt/django-cachalot";
changelog = "https://github.com/noripyt/django-cachalot/blob/${src.rev}/CHANGELOG.rst";
license = licenses.bsd3;
maintainers = with maintainers; [ onny ];
};
}

View File

@ -0,0 +1,65 @@
diff --git a/cachalot/tests/models.py b/cachalot/tests/models.py
index 8c48640..817602c 100644
--- a/cachalot/tests/models.py
+++ b/cachalot/tests/models.py
@@ -77,11 +77,6 @@ class PostgresModel(Model):
date_range = DateRangeField(null=True, blank=True)
datetime_range = DateTimeRangeField(null=True, blank=True)
- class Meta:
- # Tests schema name in table name.
- db_table = '"public"."cachalot_postgresmodel"'
-
-
class UnmanagedModel(Model):
name = CharField(max_length=50)
diff --git a/settings.py b/settings.py
index 19d7560..7095367 100644
--- a/settings.py
+++ b/settings.py
@@ -8,18 +8,9 @@ DATABASES = {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'cachalot.sqlite3',
},
- 'postgresql': {
- 'ENGINE': 'django.db.backends.postgresql',
- 'NAME': 'cachalot',
- 'USER': 'cachalot',
- 'PASSWORD': 'password',
- 'HOST': '127.0.0.1',
- },
- 'mysql': {
- 'ENGINE': 'django.db.backends.mysql',
- 'NAME': 'cachalot',
- 'USER': 'root',
- 'HOST': '127.0.0.1',
+ 'test': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': ':memory:',
},
}
if 'MYSQL_PASSWORD' in os.environ:
@@ -36,22 +27,6 @@ DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
DATABASE_ROUTERS = ['cachalot.tests.db_router.PostgresRouter']
CACHES = {
- 'redis': {
- 'BACKEND': 'django_redis.cache.RedisCache',
- 'LOCATION': 'redis://127.0.0.1:6379/0',
- 'OPTIONS': {
- # Since we are using both Python 2 & 3 in tests, we need to use
- # a compatible pickle version to avoid unpickling errors when
- # running a Python 2 test after a Python 3 test.
- 'PICKLE_VERSION': 2,
- },
- },
- 'memcached': {
- 'BACKEND': 'django.core.cache.backends.memcached.'
- + ('PyMemcacheCache' if __DJ_V[0] > 2
- and (__DJ_V[1] > 1 or __DJ_V[0] > 3) else 'MemcachedCache'),
- 'LOCATION': '127.0.0.1:11211',
- },
'locmem': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'OPTIONS': {

View File

@ -2699,6 +2699,8 @@ self: super: with self; {
django-bootstrap4 = callPackage ../development/python-modules/django-bootstrap4 { };
django-cachalot = callPackage ../development/python-modules/django-cachalot { };
django-cache-url = callPackage ../development/python-modules/django-cache-url { };
django-cacheops = callPackage ../development/python-modules/django-cacheops { };