higlass / higlass/higlass-server

Django DEFAULT_AUTO_FIELD warnings

Open
#147 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
22
Forks
22
PR merge metrics
No merged PRs in 30d

Description

I set up a higlass-server instance from the develop branch (28 Oct 2021), using the current higlass-docker [Dockerfile](https://github.com/higlass/higlass-docker/blob/master/web-context/Dockerfile.template) as a recipe.

I tested a simple ingest of a custom-sized chromsizes file:

```
$ make ingest
python /home/higlass/projects/higlass-server/manage.py ingest_tileset --filetype chromsizes-tsv --datatype chromsizes --coordSystem hg38_fixedBin --filename hg38.chromSizes.fixedBin
System check identified some issues:

WARNINGS:
tilesets.Project: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the TilesetsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
tilesets.Tileset: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the TilesetsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
tilesets.ViewConf: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the TilesetsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
```

I started from an Ubuntu 20.04 LTS AMI:

```
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
```

This host is running Django 3.2.8:

```
$ python -m django --version
3.2.8
```

Adding the following to `/home/higlass/projects/higlass-server/higlass_server/settings.py` cleared the warnings on subsequent ingest attempts:

```
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
```

I don't know if this is the correct solution or might have unintended consequences, however. This appears to be related to a primary key not being defined for models, and I'm not sure if putting in a default would have side effects.

Among other differences, my old higlass-server instance is running Django 2.1.5 and I don't recall seeing these warnings there. It appears this may be a consequence of running [Django 3.2 (or newer)](https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-created-primary-keys).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.