Multipage sites in python

Notes/Reminders:

Tasks:

  1. Using your file explorer of choice (i.e. not python), create a directory called hw18, in the same place as your .py file. NOTE: the .py should be outside the hw18 directory.

  2. Write a python function makeNPages(n): that writes out n files, page_0.html, page_1.html, ... , page_n‑1.html. All of your html files should be created inside your hw18/ directory, which you can do using open("hw18/page_0.html", "w").

  3. Make sure you generate each html page with the following:

  4. Pick a value for n between 3 and 6. Use your .py function to generate that many pages under your hw18/ directory

  5. Use Cyberduck or WinSCP to upload your site (i.e. the entire hw18/directory) to homer, under your public_html folder.

  6. Verify that you can see the results at homer.stuy.edu/~yourUsername/hw18/page_0.html. Make sure it's not a local link (i.e. not file://... or C:\...), but is actually up on the internet at homer.stuy.edu.


  7. Upload the following to the homework server:

Bonus:

The "hw18" directory must already exist for your code to work. See if you can upgrade your program to automatically check for and create that directory if it is not already there. You will need to import the 'os' module and which we have not covered, so this will recover some outside research to figure out how to do. You may need os.mkdir(), os.makedirs(), and you may need os.path.isdir() or os.path.exists() from the 'os.path' methods