From 1b9c2575a4331377f2a42c3702506c98da8b4e41 Mon Sep 17 00:00:00 2001 From: Clara <10088152+claraj@users.noreply.github.com> Date: Mon, 20 Nov 2023 15:44:15 -0600 Subject: [PATCH 1/5] Update README.md --- README.md | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a172b6b..f79960a 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,41 @@ # Example project with Django unit tests and GitHub actions -This web app has two pages, +This web app should have two pages, -The welcoming home page http://127.0.0.1:8000/ -The extremely accurate math page http://127.0.0.1:8000/two_plus_two +* The welcoming home page http://127.0.0.1:8000/ +* The extremely accurate math page http://127.0.0.1:8000/two_plus_two + +But it looks like the home page message is wrong, and the math is not correct either. + +Fortunately, there are some tests that can help identify problems, or verify things are working. Can you fix the code? +## Running the app + +Fork this repository and clone it to your computer. + +Install dependencies `pip install -r requirements.txt` (optionally create a virtual environment first) +Run the app with `python manage.py runserver` + +## Running the tests locally + +`python manage.py test` + +## GitHub Actions + +These are tasks that are performed when an event happens at GitHub. The Actions for this repository are defined in the .github/worklows/django.yml file. You don't need to understand every detail, but have a look at this file, what do you notice? + +## Your tasks + The tests are correct. They are failing because there are bugs in the code. -Please fix the code, and send me a pull request. +1. Create a new branch +2. Fix one of the problems, test by running the app and by running the tests on your computer +3. Push your branch to GitHub and create a pull request +4. Observe output from Actions in the pull request +5. In the same branch, fix the other problem, test by running the app and by running the tests on your computer +6. Push your branch to GitHub +7. Observe output from Actions in the pull request -Notice that there is a GitHub action that runs the tests, and displays information about passing and failing tests when a PR is created. From acd1c9e8e1ead2bde6330b2899f59f788c7df783 Mon Sep 17 00:00:00 2001 From: Clara <10088152+claraj@users.noreply.github.com> Date: Mon, 20 Nov 2023 16:11:42 -0600 Subject: [PATCH 2/5] Add workflow badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f79960a..d6ab41f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![Django CI](https://github.com/claraj/python-unittest-actions/actions/workflows/django.yml/badge.svg) + # Example project with Django unit tests and GitHub actions This web app should have two pages, From 8ef40eedc6505b995e8435cb135a2f3399f0158b Mon Sep 17 00:00:00 2001 From: clara <10088152+claraj@users.noreply.github.com> Date: Wed, 22 Nov 2023 19:08:10 -0600 Subject: [PATCH 3/5] update URLs for Django 4 --- hello_app/urls.py | 6 +++--- hello_project/urls.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hello_app/urls.py b/hello_app/urls.py index 01483db..0f127ff 100644 --- a/hello_app/urls.py +++ b/hello_app/urls.py @@ -1,9 +1,9 @@ -from django.conf.urls import url +from django.urls import path from . import views urlpatterns = [ - url(r'two_plus_two', views.two_plus_two, name='two_plus_two'), - url(r'', views.hello, name='hello'), + path(r'two_plus_two', views.two_plus_two, name='two_plus_two'), + path(r'', views.hello, name='hello'), ] diff --git a/hello_project/urls.py b/hello_project/urls.py index bb796a1..414524d 100644 --- a/hello_project/urls.py +++ b/hello_project/urls.py @@ -13,9 +13,9 @@ 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ -from django.conf.urls import include, url +from django.urls import include, path from django.contrib import admin urlpatterns = [ - url(r'', include('hello_app.urls')) + path(r'', include('hello_app.urls')) ] From ff4225021e38fe9ee2508accb71cdb9500ae7347 Mon Sep 17 00:00:00 2001 From: clara <10088152+claraj@users.noreply.github.com> Date: Wed, 22 Nov 2023 19:08:58 -0600 Subject: [PATCH 4/5] bump django version --- requirements.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2da2db3..723bce1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ -Django==3.2.8 -gunicorn==20.0.4 +Django==4.2.7 From 4158358e1d69e3db7747ddfe234516a644c61d8c Mon Sep 17 00:00:00 2001 From: Clara <10088152+claraj@users.noreply.github.com> Date: Tue, 2 Apr 2024 12:30:02 -0500 Subject: [PATCH 5/5] ignore IDE files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index cc891ab..2f35482 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ venv/ __pycache__ *.pyc db.sqlite3 +.idea +.vscode