mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #24358 -- Corrected code-block directives for console sessions.
This commit is contained in:
parent
ea3168dc6c
commit
eba6dff581
17 changed files with 100 additions and 134 deletions
|
@ -51,7 +51,7 @@ Install it
|
|||
Next, run the Django command-line utility to create the database tables
|
||||
automatically:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py migrate
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ It'll consist of two parts:
|
|||
We'll assume you have :doc:`Django installed </intro/install>` already. You can
|
||||
tell Django is installed and which version by running the following command:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python -c "import django; print(django.get_version())"
|
||||
|
||||
|
@ -51,7 +51,7 @@ application-specific settings.
|
|||
From the command line, ``cd`` into a directory where you'd like to store your
|
||||
code, then run the following command:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ django-admin startproject mysite
|
||||
|
||||
|
@ -190,7 +190,7 @@ Some of these applications makes use of at least one database table, though,
|
|||
so we need to create the tables in the database before we can use them. To do
|
||||
that, run the following command:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py migrate
|
||||
|
||||
|
@ -217,7 +217,7 @@ The development server
|
|||
Let's verify your Django project works. Change into the outer :file:`mysite` directory, if
|
||||
you haven't already, and run the following commands:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py runserver
|
||||
|
||||
|
@ -255,7 +255,7 @@ It worked!
|
|||
it as a command-line argument. For instance, this command starts the server
|
||||
on port 8080:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py runserver 8080
|
||||
|
||||
|
@ -263,7 +263,7 @@ It worked!
|
|||
listen on all public IPs (useful if you want to show off your work on other
|
||||
computers), use:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py runserver 0.0.0.0:8000
|
||||
|
||||
|
@ -305,7 +305,7 @@ imported as its own top-level module, rather than a submodule of ``mysite``.
|
|||
To create your app, make sure you're in the same directory as :file:`manage.py`
|
||||
and type this command:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py startapp polls
|
||||
|
||||
|
@ -434,7 +434,7 @@ look like this:
|
|||
|
||||
Now Django knows to include the ``polls`` app. Let's run another command:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py makemigrations polls
|
||||
|
||||
|
@ -464,7 +464,7 @@ schema automatically - that's called :djadmin:`migrate`, and we'll come to it in
|
|||
moment - but first, let's see what SQL that migration would run. The
|
||||
:djadmin:`sqlmigrate` command takes migration names and returns their SQL:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py sqlmigrate polls 0001
|
||||
|
||||
|
@ -534,7 +534,7 @@ your project without making migrations or touching the database.
|
|||
|
||||
Now, run :djadmin:`migrate` again to create those model tables in your database:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py migrate
|
||||
Operations to perform:
|
||||
|
@ -577,7 +577,7 @@ Playing with the API
|
|||
Now, let's hop into the interactive Python shell and play around with the free
|
||||
API Django gives you. To invoke the Python shell, use this command:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py shell
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ Creating an admin user
|
|||
First we'll need to create a user who can login to the admin site. Run the
|
||||
following command:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py createsuperuser
|
||||
|
||||
|
@ -60,7 +60,7 @@ server and explore it.
|
|||
|
||||
Recall from Tutorial 1 that you start the development server like so:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py runserver
|
||||
|
||||
|
@ -522,7 +522,7 @@ template directory in the source code of Django itself
|
|||
If you have difficulty finding where the Django source files are located
|
||||
on your system, run the following command:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ python -c "
|
||||
import sys
|
||||
|
|
|
@ -150,7 +150,7 @@ Unix ``grep`` utility to search for a phrase in all of the documentation. For
|
|||
example, this will show you each mention of the phrase "max_length" in any
|
||||
Django document:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ grep -r max_length /path/to/django/docs/
|
||||
|
||||
|
@ -163,14 +163,14 @@ You can get a local copy of the HTML documentation following a few easy steps:
|
|||
plain text to HTML. You'll need to install Sphinx by either downloading
|
||||
and installing the package from the Sphinx Web site, or with ``pip``:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ pip install Sphinx
|
||||
|
||||
* Then, just use the included ``Makefile`` to turn the documentation into
|
||||
HTML:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ cd path/to/django/docs
|
||||
$ make html
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue