Page-240 Server Unable To Locate Index.html
4 replies to this topic
Posted 27 August 2012 - 12:52 AM
y is the server unable to locate the index.html, favicon.ico files??? is there a problem with the folder structure??
hence my home page is not showing on pg-240
Posted 29 August 2012 - 12:03 AM
It sounds like you are missing some of the files (although you can generally forget about about the favicon.ico file, as it's optional).
Here's something to try: download the code from the headfirstlabs.com website for the chapter you are working on, and get it to run. Then compare the downloaded code with your code to see what's missing.
Hope this helps.
Posted 29 August 2012 - 02:09 AM
Thanks for your reply. I must say u've written a great book. I, as a user, love it.
For the problem above, i was able to solve it by myself. I'm confused about directories and the accordance of how programs read files in particular locations in them.
For example :- In chapter 8 - when u transfer the python script to the emulator via tools/adb push command.....the file to be transferred (lets say mydroidtest.py) has to be in the tools folder itself. So i have to copy it there and then execute the given command and then delete it from there. Is there a better way?????
Another example :- In chapter 7 - Following the webapp directory structure , when i try to execute a program in the cgi-bin folder in IDLE (lets say the program which includes include_header and include_footer commands to be exectuted) then the output gives an error saying "No such file or Directory: templates/header.html". Then i paste the templates folder in the cgi-bin folder , run the program and now IDLE gives no such error and the program is executed fine. But when the whole webapp runs there's no problem with the webapp directory structure given by you. Can You Please explain this to me as my previous problem was also due to confusion in understanding directories????????????
Posted 29 August 2012 - 03:16 AM
The "problem" with IDLE is that when it starts up, it is generally not in the directory that you have your code in. This can cause problems when your code expects to find Python code in certain files in certain places (directories), and they aren't there... because IDLE starts looking from its current directory, which is very unlikely to be the one you have your code in.
When you run Python from the command-line, you are more than likely already in the directory that contains your code, so this issue pops up less.
To work out where Python or IDLE thinks it is, use these commands at the shell:
>>> import os
That'll display the current working directory. To change this to the directory that contains your code (in "mycode", for instance) use:
or if you are on Windows:
Reissuing the os.getcwd() command should confirm that Python/IDLE is now working from your code directory.
Also: see the IDLE session on page 76. :-)
As regards the tools/adb command, that's how it works. You need to copy the file into the "tools" directory before you push it, or provide adb with the full path-name to your file. It's a little basic, but it works.
Thanks for the kind words on the book. Delighted to see you are enjoying yourself (and - hopefully - learning lots). :-)
I hope my explanation helps.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users