summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorKudz <kudzayibamhare@gmail.com>2024-04-24 16:31:10 +0200
committerNatalia <124304+nessita@users.noreply.github.com>2024-07-04 15:32:05 -0300
commitb38a1814811294962c59af1e1c166f1545f887ea (patch)
tree0f581c2e1b52b2b6ffaa72efee656b1404a5810f /docs
parent2da007737cda936ef2ee87271bf9e69eb93cd3fe (diff)
[5.1.x] Relocated database setup details to install docs to simplify tutorial 2.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com> Backport of 82c71f0168b1c132e499505609d285c6016ed4f2 from main.
Diffstat (limited to 'docs')
-rw-r--r--docs/intro/tutorial02.txt49
-rw-r--r--docs/topics/install.txt31
2 files changed, 37 insertions, 43 deletions
diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt
index 3cda0d38d6..d43c82c5d2 100644
--- a/docs/intro/tutorial02.txt
+++ b/docs/intro/tutorial02.txt
@@ -17,48 +17,15 @@ Database setup
Now, open up :file:`mysite/settings.py`. It's a normal Python module with
module-level variables representing Django settings.
-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. When starting your first real project, however, you may want to use a
-more scalable database like PostgreSQL, to avoid database-switching headaches
-down the road.
+By default, the :setting:`DATABASES` 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. When starting your first real project, however,
+you may want to use a more scalable database like PostgreSQL, to avoid
+database-switching headaches down the road.
-If you wish to use another database, install the appropriate :ref:`database
-bindings <database-installation>` and change the following keys in the
-:setting:`DATABASES` ``'default'`` item to match your database connection
-settings:
-
-* :setting:`ENGINE <DATABASE-ENGINE>` -- Either
- ``'django.db.backends.sqlite3'``,
- ``'django.db.backends.postgresql'``,
- ``'django.db.backends.mysql'``, or
- ``'django.db.backends.oracle'``. Other backends are :ref:`also available
- <third-party-notes>`.
-
-* :setting:`NAME` -- The name of your database. If you're using SQLite, the
- database will be a file on your computer; in that case, :setting:`NAME`
- should be the full absolute path, including filename, of that file. The
- default value, ``BASE_DIR / 'db.sqlite3'``, will store the file in your
- project directory.
-
-If you are not using SQLite as your database, additional settings such as
-:setting:`USER`, :setting:`PASSWORD`, and :setting:`HOST` must be added.
-For more details, see the reference documentation for :setting:`DATABASES`.
-
-.. admonition:: For databases other than SQLite
-
- If you're using a database besides SQLite, make sure you've created a
- database by this point. Do that with "``CREATE DATABASE database_name;``"
- within your database's interactive prompt.
-
- Also make sure that the database user provided in :file:`mysite/settings.py`
- has "create database" privileges. This allows automatic creation of a
- :ref:`test database <the-test-database>` which will be needed in a later
- tutorial.
-
- If you're using SQLite, you don't need to create anything beforehand - the
- database file will be created automatically when it is needed.
+If you wish to use another database, see :ref:`details to customize and get
+your database running <database-installation>`.
While you're editing :file:`mysite/settings.py`, set :setting:`TIME_ZONE` to
your time zone.
diff --git a/docs/topics/install.txt b/docs/topics/install.txt
index e93a6e0d54..5200b6b80b 100644
--- a/docs/topics/install.txt
+++ b/docs/topics/install.txt
@@ -76,8 +76,8 @@ In addition to the officially supported databases, there are :ref:`backends
provided by 3rd parties <third-party-notes>` that allow you to use other
databases with Django.
-In addition to a database backend, you'll need to make sure your Python
-database bindings are installed.
+To use another database other than SQLite, you'll need to make sure that the
+appropriate Python database bindings are installed:
* If you're using PostgreSQL, you'll need the `psycopg`_ or `psycopg2`_
package. Refer to the :ref:`PostgreSQL notes <postgresql-notes>` for further
@@ -97,6 +97,33 @@ database bindings are installed.
* If you're using an unofficial 3rd party backend, please consult the
documentation provided for any additional requirements.
+And ensure that the following keys in the ``'default'`` item of the
+:setting:`DATABASES` dictionary match your database connection settings:
+
+* :setting:`ENGINE <DATABASE-ENGINE>` -- Either
+ ``'django.db.backends.sqlite3'``,
+ ``'django.db.backends.postgresql'``,
+ ``'django.db.backends.mysql'``, or
+ ``'django.db.backends.oracle'``. Other backends are :ref:`also available
+ <third-party-notes>`.
+
+* :setting:`NAME` -- The name of your database. If you’re using SQLite, the
+ database will be a file on your computer. In that case, ``NAME`` should be
+ the full absolute path, including the filename of that file. You don’t need
+ to create anything beforehand; the database file will be created
+ automatically when needed. The default value, ``BASE_DIR / 'db.sqlite3'``,
+ will store the file in your project directory.
+
+.. admonition:: For databases other than SQLite
+
+ If you are not using SQLite as your database, additional settings such as
+ :setting:`USER`, :setting:`PASSWORD`, and :setting:`HOST` must be added.
+ For more details, see the reference documentation for :setting:`DATABASES`.
+
+ Also, make sure that you've created the database by this point. Do that
+ with "``CREATE DATABASE database_name;``" within your database's
+ interactive prompt.
+
If you plan to use Django's ``manage.py migrate`` command to automatically
create database tables for your models (after first installing Django and
creating a project), you'll need to ensure that Django has permission to create