[FIXED] no such table: app_contact

Hello,
I read other messages here but they don’t seem to fix my problem so I just signed up.
I’m learning GitHub - EmilStenstrom/django-components: Create simple reusable template components in Django. and GitHub - iwanalabs/django-htmx-components
Here are my folders:
image

app/models.py has

class Contact(models.Model):
    first_name = models.CharField(max_length=100)
    last_name = models.CharField(max_length=100)
    email = models.EmailField()
    status = models.CharField(max_length=100, default="Inactive")

app/admin.py registers the Contact table.
After making migrations and migrate, I have the tables in django_content_type, but no contact table was created.
At 127.0.0.1:8000/admin/app/contact/ I always get:

OperationalError at /admin/app/contact/

no such table: app_contact

I deleted the db and retried from scratch, no luck.
I renamed the db in settings.py and tried to migrate, no luck.

Since django_components asks to remove the lines:

  • 'django.contrib.staticfiles' from INSTALLED_APPS
  • 'APP_DIRS': True from the TEMPLATES and adds other TEMPLATES (builtin, loaders)

does it influence the migrations?
Or is it something else?

Django 5.0.6, python 3.10 venv, on ubuntu 22.04

Thank you!

what’s the content of the relevant migration file(s)?
does the table actually exist?

You don’t have a migrations directory showing in your app directory.

The first time you run makemigrations with a new app, you generally want to specify the app name.

See the docs for the makemigrations command.

Also, it’s unusual to put app components (models, views, admin, etc) in your project’s directory - the one that contains your settings, wsgi, root urls, etc.

I agree, I wanted to quickly give the components a try and I’ve cut corners.
For a fresh new db, we can see tables are ignored:

python manage.py makemigrations && python manage.py migrate
No changes detected
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying sessions.0001_initial... OK

because I used a make migrate command (that didn’t precise the app name), it fails.
Once it’s added, it does work:
app/migrations/0001_initial.py
- Create model Contact

Applying app.0001_initial… OK

Thank you for pointing me to this important detail @KenWhitesell