diff options
| author | Ramiro Morales <ramiro@users.noreply.github.com> | 2018-01-20 14:38:48 -0300 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-01-20 12:38:48 -0500 |
| commit | 37c17846ad6b02c6dca72e8087a279cca04a0c27 (patch) | |
| tree | 03c6dc058936e14daee338dca6413915dcad8f93 /docs/intro | |
| parent | a22ef3bb379a8783d0a2c3d7e1de531dce220a75 (diff) | |
Fixed #28343 -- Add an OS chooser for docs command line examples.
Diffstat (limited to 'docs/intro')
| -rw-r--r-- | docs/intro/contributing.txt | 52 | ||||
| -rw-r--r-- | docs/intro/overview.txt | 2 | ||||
| -rw-r--r-- | docs/intro/tutorial01.txt | 14 | ||||
| -rw-r--r-- | docs/intro/tutorial02.txt | 14 | ||||
| -rw-r--r-- | docs/intro/tutorial07.txt | 2 | ||||
| -rw-r--r-- | docs/intro/whatsnext.txt | 4 |
6 files changed, 35 insertions, 53 deletions
diff --git a/docs/intro/contributing.txt b/docs/intro/contributing.txt index ac81e13610..07d9aae379 100644 --- a/docs/intro/contributing.txt +++ b/docs/intro/contributing.txt @@ -96,12 +96,6 @@ To check whether or not you have Git installed, enter ``git`` into the command line. If you get messages saying that this command could not be found, you'll have to download and install it, see `Git's download page`__. -.. admonition:: For Windows users - - When installing Git on Windows, it is recommended that you pick the - "Git Bash" option so that Git runs in its own shell. This tutorial assumes - that's how you have installed it. - If you're not that familiar with Git, you can always find out more about its commands (once it's installed) by typing ``git help`` into the command line. @@ -117,7 +111,7 @@ where you'll want your local copy of Django to live. Download the Django source code repository using the following command: -.. code-block:: console +.. console:: $ git clone git@github.com:YourGitHubName/django.git @@ -130,30 +124,18 @@ your projects so that they don't interfere with each other. It's a good idea to keep all your virtualenvs in one place, for example in ``.virtualenvs/`` in your home directory. Create it if it doesn't exist yet: -.. code-block:: console +.. console:: $ mkdir ~/.virtualenvs Now create a new virtualenv by running: -.. code-block:: console +.. console:: - $ python3 -m venv ~/.virtualenvs/djangodev + $ python -m venv ~/.virtualenvs/djangodev The path is where the new environment will be saved on your computer. -.. admonition:: For Windows users - - Using the built-in ``venv`` module will not work if you are also using the - Git Bash shell on Windows, since activation scripts are only created for the - system shell (``.bat``) and PowerShell (``.ps1``). Use the ``virtualenv`` - package instead: - - .. code-block:: none - - $ pip install virtualenv - $ virtualenv ~/.virtualenvs/djangodev - .. admonition:: For Ubuntu users On some versions of Ubuntu the above command might fail. Use the @@ -182,9 +164,9 @@ If the ``source`` command is not available, you can try using a dot instead: To activate your virtualenv on Windows, run: - .. code-block:: none + .. code-block:: doscon - $ source ~/virtualenvs/djangodev/Scripts/activate + ...\> %HOMEPATH%\.virtualenvs\djangodev\Scripts\activate.bat You have to activate the virtualenv whenever you open a new terminal window. virtualenvwrapper__ is a useful tool for making this more convenient. @@ -197,7 +179,7 @@ name of the currently activated virtualenv is displayed on the command line to help you keep track of which one you are using. Go ahead and install the previously cloned copy of Django: -.. code-block:: console +.. console:: $ pip install -e /path/to/your/local/clone/django/ @@ -231,7 +213,7 @@ Navigate into Django's root directory (that's the one that contains ``django``, ``docs``, ``tests``, ``AUTHORS``, etc.). You can then check out the older revision of Django that we'll be using in the tutorial below: -.. code-block:: console +.. console:: $ git checkout 4ccfc4439a7add24f8db4ef3960d02ef8ae09887 @@ -249,7 +231,7 @@ what its output is supposed to look like. Before running the test suite, install its dependencies by first ``cd``-ing into the Django ``tests/`` directory and then running: -.. code-block:: console +.. console:: $ pip install -r requirements/py3.txt @@ -261,7 +243,7 @@ encounter. Now we are ready to run the test suite. If you're using GNU/Linux, macOS, or some other flavor of Unix, run: -.. code-block:: console +.. console:: $ ./runtests.py @@ -313,7 +295,7 @@ Creating a branch for your patch Before making any changes, create a new branch for the ticket: -.. code-block:: console +.. console:: $ git checkout -b ticket_24788 @@ -406,7 +388,7 @@ so our tests are going to fail. Let's run all the tests in the ``forms_tests`` folder to make sure that's really what happens. From the command line, ``cd`` into the Django ``tests/`` directory and run: -.. code-block:: console +.. console:: $ ./runtests.py forms_tests @@ -443,7 +425,7 @@ earlier pass, so we can see whether the code we wrote above is working correctly. To run the tests in the ``forms_tests`` folder, ``cd`` into the Django ``tests/`` directory and run: -.. code-block:: console +.. console:: $ ./runtests.py forms_tests @@ -475,7 +457,7 @@ help identify many bugs and regressions that might otherwise go unnoticed. To run the entire Django test suite, ``cd`` into the Django ``tests/`` directory and run: -.. code-block:: console +.. console:: $ ./runtests.py @@ -517,7 +499,7 @@ Now it's time to go through all the changes made in our patch. To display the differences between your current copy of Django (with your changes) and the revision that you initially checked out earlier in the tutorial: -.. code-block:: console +.. console:: $ git diff @@ -612,7 +594,7 @@ Committing the changes in the patch To commit the changes: -.. code-block:: console +.. console:: $ git commit -a @@ -629,7 +611,7 @@ Pushing the commit and making a pull request After committing the patch, send it to your fork on GitHub (substitute "ticket_24788" with the name of your branch if it's different): -.. code-block:: console +.. console:: $ git push origin ticket_24788 diff --git a/docs/intro/overview.txt b/docs/intro/overview.txt index 203e501054..f6e34b0695 100644 --- a/docs/intro/overview.txt +++ b/docs/intro/overview.txt @@ -51,7 +51,7 @@ Install it Next, run the Django command-line utility to create the database tables automatically: -.. code-block:: console +.. console:: $ python manage.py migrate diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt index c9f1b4b057..1904e5474e 100644 --- a/docs/intro/tutorial01.txt +++ b/docs/intro/tutorial01.txt @@ -16,7 +16,7 @@ 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 in a shell prompt (indicated by the $ prefix): -.. code-block:: console +.. console:: $ python -m django --version @@ -52,7 +52,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:: console +.. console:: $ django-admin startproject mysite @@ -123,7 +123,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:: console +.. console:: $ python manage.py runserver @@ -169,7 +169,7 @@ It worked! it as a command-line argument. For instance, this command starts the server on port 8080: - .. code-block:: console + .. console:: $ python manage.py runserver 8080 @@ -178,7 +178,7 @@ It worked! running Vagrant or want to show off your work on other computers on the network), use: - .. code-block:: console + .. console:: $ python manage.py runserver 0:8000 @@ -219,7 +219,7 @@ 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:: console +.. console:: $ python manage.py startapp polls @@ -316,7 +316,7 @@ app will still work. You have now wired an ``index`` view into the URLconf. Lets verify it's working, run the following command: -.. code-block:: console +.. console:: $ python manage.py runserver diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt index e9b2aaa2a3..12e1a73630 100644 --- a/docs/intro/tutorial02.txt +++ b/docs/intro/tutorial02.txt @@ -85,7 +85,7 @@ Some of these applications make 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:: console +.. console:: $ python manage.py migrate @@ -226,7 +226,7 @@ this: Now Django knows to include the ``polls`` app. Let's run another command: -.. code-block:: console +.. console:: $ python manage.py makemigrations polls @@ -256,7 +256,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:: console +.. console:: $ python manage.py sqlmigrate polls 0001 @@ -332,7 +332,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:: console +.. console:: $ python manage.py migrate Operations to perform: @@ -373,7 +373,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:: console +.. console:: $ python manage.py shell @@ -575,7 +575,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:: console +.. console:: $ python manage.py createsuperuser @@ -608,7 +608,7 @@ server and explore it. If the server is not running start it like so: -.. code-block:: console +.. console:: $ python manage.py runserver diff --git a/docs/intro/tutorial07.txt b/docs/intro/tutorial07.txt index 04f2fa7060..5924f55c6a 100644 --- a/docs/intro/tutorial07.txt +++ b/docs/intro/tutorial07.txt @@ -342,7 +342,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:: console + .. console:: $ python -c "import django; print(django.__path__)" diff --git a/docs/intro/whatsnext.txt b/docs/intro/whatsnext.txt index 019dfed3a9..e7d3dad818 100644 --- a/docs/intro/whatsnext.txt +++ b/docs/intro/whatsnext.txt @@ -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:: console +.. console:: $ grep -r max_length /path/to/django/docs/ @@ -163,7 +163,7 @@ 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 website, or with ``pip``: - .. code-block:: console + .. console:: $ pip install Sphinx |
