higlass-server icon indicating copy to clipboard operation
higlass-server copied to clipboard

Django DEFAULT_AUTO_FIELD warnings

Open alexpreynolds opened this issue 2 years ago • 0 comments

I set up a higlass-server instance from the develop branch (28 Oct 2021), using the current higlass-docker Dockerfile 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).

alexpreynolds avatar Oct 29 '21 00:10 alexpreynolds