![]() |
VOOZH | about |
Our task is to build a simple Django application that counts the number of words in a given text. This is a great beginner project if you have some basic knowledge of Django.
Refer to the below article to know about basics of Django.
First, we create a function called counter in views.py which will handle the logic for counting words:
Explanation:
In your app's urls.py, map the URL /counter to your counter view:
Then include your app URLs in the main project urls.py:
Create a file called counter.html inside your app’s templates folder and add the following code:
Notes:
Make sure your Django server is running:
python manage.py runserver
Output:
👁 TemplateDoesNotExist at /counter