Database Settings
Now, open the mystic/setting.py. It's a generic Python module with module-level variables that represent Django settings.
Django defaults to using the SQLite database. If you are unfamiliar with the database, or if you are just interested in trying to Django, this is the easiest choice. The SQLite database is contained in Python, so you don't need to install anything else to support your database. However, when you start your first project, you may want to use a more powerful database, such as PostgreSQL, to avoid the headaches of switching databases on future roads.
If you want to use a different database, install the appropriate database bindings and change the keys in databases ' default ' to match your database connection settings: engine-'django.db.backends.sqlite3 ' or 'django.db.backends.postgresql_psycopg2' or 'django.db.backends.mysql ' or ' Django.db.backends.oracle' name-the name of your database. If you use SQLite, the database will be a file on your computer; In that case, name should be an absolute path, including the filename. The default value Os.path.join (Base_dir, ' db.sqlite3 ') stores the files in your engineering directory.
If you are not using the SQLite database, additional settings, such as user,password,host, must be added:
DATABASES = {'
default ': {
' ENGINE ': ' django.db.backends.postgresql_psycopg2 ', '
NAME ': ' MyDatabase ',
' USER ': ' Mydatabaseuser ', '
PASSWORD ': ' MyPassword ',
' HOST ': ' 127.0.0.1 ',
' PORT ': ' 5432 ',
}
}
Note: If you are using PostgreSQL or MySQL, make sure that you have created the database at this time. Execute the CREATE DATABASE database_name in your DB interaction command. If you're using the SQLite database, you don't have to create anything, and the database files are created automatically.
When you edit mysite/setting.py, please set the Time_zone to your own time zone.
Also pay attention to installed_app this setting. This setting takes note of the names of all Django applications that can be used in many projects and can be packaged and propagated.
By default, Installed_app contains the following applications: Django.contrib.admin: A management website Django.contrib.auth: A validation system Django.contrib.contenttypes: A framework of content types Django.contrib.sessions: A session framework Django.contrib.messages: A message framework Django.contrib.staticfiles: A framework for managing static files
Some applications make the most of at least one database table, so create a datasheet in the database before using them. To do that, run the following command:
Python manage.py Migrate