Day 9: Exploring Python with Projects

We ran lot of commands on Day 8, let us see what they mean. A quick review of files created in the process is listed at ““Hello World” Using Django (First App)”:

__init__.py will be a blank script similar to our project file.

We can register our models in the admin.py for interfacing.

Application specific configurations are placed in apps.py.

The data models for applications are stored in models.py.

Test cases for our application can be made available in tests.py.

Views.py consists of functions which handle requests and return responses.

Migrations contain database-model specific information.

Another basic concept which needs to clear by now is usage of the Virtualenv tool.  Here is a wonderfully frank admission by Jason on why Virtualenv can be pain for beginners:

For my first several dozen attempts at using virtual environments, I managed to get something horribly wrong. They never worked. I hate to admit it, but I don’t even know what I did anymore! Ever since I’ve learned how virtual environments worked, I haven’t had a single problem with them.

Read more on Virtualenv  here.

A tip from “All you need to know about python virtual environments”:

To activate the virtual environments on Windows is slightly different. You can do that as mentioned in Hitchhikers Python guide as C:UsersSomeUserproject_folder> venvScriptsactivate.

If all this is clear, then when you run all the steps listed till Day 8, then entering “http://127.0.0.1:8000” on your browser should yield:

“Hello World”

End of Day  9.

One thought on “Day 9: 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