Continuing from Day 7, we take the next steps listed at “Building an Hello World Application with Python/Django”.
I had to run “python manage.py runserver” again to get django sever to launch:
Next steps:
- django-admin startapp my_app # Create a new django app named my_app OR python manage.py startapp my_app # Create a new django app named my_app
- open helloworld_project/settings.py file in a text editor and add my_app to the INSTALLED_APPS list.
- cd my_app # Change directory into the new my_app directory
- mkdir templates # Make a new directory named templates
- cd templates # Change directory into the templates directory
- touch index.html # Create a new index.html file : The touch command to create a new file was not recognized. Not sure what is the reason. I went ahead and anyway created the file through a text editor with basic “Hello World” HTML code.
- Next we need to go up to my_app directory, open the views.py file with a text editor and paste with the given code snippet to set up a Django view – to determine what would be displayed to the user at a given route.
- Next, to set up a route to map to this view urls.py file (located in the inner hello_world project) is updated.
End of Day 8.
2 thoughts on “Day 8: Exploring Python with Projects”