Day 8: Exploring Python with Projects

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:

  1. 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
  2. open helloworld_project/settings.py file in a text editor and add my_app to the INSTALLED_APPS list.
  3. cd my_app # Change directory into the new my_app directory
  4. mkdir templates # Make a new directory named templates
  5. cd templates # Change directory into the templates directory
  6. 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.
  7. 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.
  8. 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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s