Skip to content

Commit

Permalink
docs: language changes and clarify instructions (#709)
Browse files Browse the repository at this point in the history
- Update the language to be more aligned with a tutorial, i.e., a learning experience we're going on together
- Clarified instructions in the "Update Django application" section to replace the contents of the time_app/views.py and django_hello_world/urls.py files. If the user inserts the contents without replacing the previous text, this leads to an Internal Service Error when the user sends a request to the /time/ endpoint.

---------

Co-authored-by: Alex Lowe <[email protected]>
  • Loading branch information
erinecon and lengau authored Sep 25, 2024
1 parent eb01dbf commit 2c375fe
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions docs/tutorial/django.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Build a rock for a Django application
-------------------------------------

In this tutorial you will create a simple Django application and learn how to
In this tutorial, we'll create a simple Django application and learn how to
containerise it in a rock, using Rockcraft's ``django-framework``
:ref:`extension <django-framework-reference>`.

Expand Down Expand Up @@ -73,7 +73,7 @@ The Django application looks good, so you can stop it for now using ``ctrl+C``.
Pack the Django application into a rock
=======================================

First, you'll need a ``rockcraft.yaml`` file. Rockcraft will automate its
First, we'll need a ``rockcraft.yaml`` file. Rockcraft will automate its
creation and tailoring for a Django application by using the
``django-framework`` profile:

Expand Down Expand Up @@ -136,7 +136,7 @@ tutorial.
Run the Django rock with Docker
===============================

You already have the rock as an `OCI <OCI_image_spec_>`_ archive. Now you'll
We already have the rock as an `OCI <OCI_image_spec_>`_ archive. Now we'll
need to load it into Docker:

.. literalinclude:: code/django/task.yaml
Expand Down Expand Up @@ -166,7 +166,7 @@ size:
The size of the image reported by Docker is the uncompressed size which is
larger than the size of the compressed ``.rock`` file.

Now you're ready to run the rock and test your containerised Django application:
Now we're ready to run the rock and test your containerised Django application:

.. literalinclude:: code/django/task.yaml
:language: text
Expand Down Expand Up @@ -216,8 +216,8 @@ You can also choose to follow the logs by using the ``-f`` option with the
Cleanup
~~~~~~~

Now you have a fully functional rock for you Django application! This concludes
the first part of this tutorial, so you can stop the container and remove the
Now we have a fully functional rock for our Django application! This concludes
the first part of this tutorial, so we can stop the container and remove the
respective image for now:

.. literalinclude:: code/django/task.yaml
Expand Down Expand Up @@ -272,7 +272,7 @@ As before, verify that the new rock was created:
You'll verify that the new Django rock is now approximately **15% smaller**
in size! And that's just because of the simple change of ``base``.

And the functionality is still the same. As before, you can confirm this by
And the functionality is still the same. As before, we can confirm this by
running the rock with Docker:

.. literalinclude:: code/django/task.yaml
Expand All @@ -295,7 +295,7 @@ Unsurprisingly, the Django application should still respond with
Cleanup
~~~~~~~

And that's it. You can now stop the container and remove the corresponding
And that's it. We can now stop the container and remove the corresponding
image:

.. literalinclude:: code/django/task.yaml
Expand All @@ -309,16 +309,16 @@ image:
Update Django application
=========================

As a final step, let's say you want to update your application. For example,
you want to add a new ``/time/`` endpoint which returns the current time.
As a final step, let's update our application. For example,
we want to add a new ``/time/`` endpoint which returns the current time.

.. literalinclude:: code/django/task.yaml
:language: bash
:start-after: [docs:create-time-app]
:end-before: [docs:create-time-app-end]
:dedent: 2

Open the file ``time_app/views.py`` and insert the following contents:
Open the file ``time_app/views.py`` and replace its contents with the following:

.. literalinclude:: code/django/time_app_views.py
:language: python
Expand All @@ -328,12 +328,13 @@ Create the file ``time_app/urls.py`` with the following contents:
.. literalinclude:: code/django/time_app_urls.py
:language: python

Open the file ``django_hello_world/urls.py`` and insert the following contents:
Open the file ``django_hello_world/urls.py`` and replace its contents with
the following:

.. literalinclude:: code/django/urls.py
:language: python

Since you are creating a new version of your application, go back to the
Since we are creating a new version of the application, go back to the
tutorial root directory using ``cd ..`` and open the ``rockcraft.yaml`` file and
change the ``version`` (e.g. to ``0.2``).

Expand Down Expand Up @@ -375,7 +376,7 @@ The updated application should respond with the current date and time (e.g.
Cleanup
~~~~~~~

You can now stop the container and remove the corresponding image:
We can now stop the container and remove the corresponding image:

.. literalinclude:: code/django/task.yaml
:language: bash
Expand All @@ -386,7 +387,7 @@ You can now stop the container and remove the corresponding image:
Reset your environment
======================

You've reached the end of this tutorial.
We've reached the end of this tutorial.

If you'd like to reset your working environment, you can simply run the
following:
Expand Down

0 comments on commit 2c375fe

Please sign in to comment.