When working with databases with Django, it automatically creates 12 default tables in the database.
I understand that I need dango_session
for storing the session and probably django_site
. But why do I need the others?
In PHP I used to store users in my own custom tables. Shouldn't I do that anymore?
By default, the configuration uses SQLite. If you're new to databases, or you're just interested in trying Django, this is the easiest choice. SQLite is included in Python, so you won't need to install anything else to support your database.
Django comes with built-in database backends. You may subclass an existing database backends to modify its behavior, features, or configuration. You can see the current list of database engines by looking in django/db/backends.
Django made creating the tables in the database very simple with its built-in ORM. To create table in the database with django is to create a django model with all required fields and then create migrations and apply them.
The tables are created because you have django.contrib.auth
, django.contrib.sessions
, and so on in your INSTALLED_APPS
setting. You shouldn't delete the tables if the apps are installed, as Django will expect them to exist.
None of the contrib apps are required to run Django. However, I highly recommend that you use the Django auth
and sessions
app instead of writing your own. For example, if you use the auth app, you don't need to worry about how to hash passwords, and there are lots of helpful views included to log users in, reset passwords and so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With