"no such table": models.py not generating DB tables?

(I’m returning to an app that I haven’t used for some time, so this may have to do with changes due to django v3 → django v5?)

I expect all classes in models.py to generate tables in the (sqlite) database. But while the admin interface shows these classes:

clicking on any of them generates an error like this:

OperationalError at /admin/djggApp/event/

		no such table: djggApp_event

		Request Method: 	GET
		Request URL: 	http://127.0.0.1:8000/admin/djggApp/event/
		Django Version: 	5.0.4
		Exception Type: 	OperationalError
		Exception Value: 	

		no such table: djggApp_event

		Exception Location: 	/usr/local/Caskroom/miniconda/base/envs/djgg/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py, line 329, in execute
		Raised during: 	django.contrib.admin.options.changelist_view
		Python Executable: 	/usr/local/Caskroom/miniconda/base/envs/djgg/bin/python
		Python Version: 	3.11.8
		Python Path: 	

		['/System/Volumes/Data/rikData/virtualenv/djgg/djggProj',
		'/Users/rik/rikData/virtualenv/djgg/djggProj',
		'/usr/local/Caskroom/miniconda/base/envs/djgg/lib/python311.zip',
		'/usr/local/Caskroom/miniconda/base/envs/djgg/lib/python3.11',
		'/usr/local/Caskroom/miniconda/base/envs/djgg/lib/python3.11/lib-dynload',
		'/usr/local/Caskroom/miniconda/base/envs/djgg/lib/python3.11/site-packages']

And looking into the sqlite database, while it contains the auth_* and django_* tables, the app’s tables are not there. Why would that be?!

Here is the first bit of the models.py file

I’ve also poked at the INSTALLED_APPS from the shell:

python manage.py shell
>>> import os
>>> os.getcwd()
'.../djggProj'
>>> import djggProj.settings
>>> djggProj.settings.INSTALLED_APPS
['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'csvimport.app.CSVImportConf', 'crispy_forms', 'rest_framework', 'debug_toolbar', 'djggApp']

and that seems right, too.

am I required to create a migration or fixture with initial data, or…? Thanks for any hints.

Have you run migrate on that database?

What does a showmigrations show?

If you don’t have any migrations for djggApp, then you may need to run makemigrations with the app name as a parameter. (See the docs for makemigrations for more details.)

Bang, that was it! I had not appreciated the need to do it to new models, I thought it only applied to “…based on the changes detected to your models”. Thanks so much Ken!