Cool, actually I was going to write something like this just the other day.
Btw, I think directory 'controllers' should be created before: controller_filename = os.path.join(destination,'controllers',prefix+'.py') open(controller_filename,'w').write(controller) so, it will not complain on 'No such file or directory' On Wednesday, August 7, 2013 1:28:20 AM UTC+3, Massimo Di Pierro wrote: > > I just pushed a new version: > > https://github.com/web2py/web2py/blob/master/scripts/import_static.py > > Massimo > > On Tuesday, 6 August 2013 16:51:31 UTC-5, tim spear wrote: >> >> Hi Massimo, >> >> Thanks for the reply. >> I'm a bit new to this but I looked in >> https://github.com/web2py/web2py/tree/master/scripts and in >> https://code.google.com/p/web2py/ >> and could not find scripts/import_static.py >> >> Not sure I looked in the right place? >> >> Ta, Tim >> >> >> On Tuesday, August 6, 2013 6:38:03 PM UTC+1, Massimo Di Pierro wrote: >>> >>> Try this: >>> >>> scripts/import_static.py >>> >>> I just committed it to trunk. Usage: >>> >>> python scripts/import_static.py source_folder applications/web2py_app >>> >>> >>> >>> On Tuesday, 6 August 2013 08:05:24 UTC-5, tim spear wrote: >>>> >>>> Hi Massimo, if you are still reading this stuff. >>>> >>>> I've been playing with web2py and was thinking it was missing an easy >>>> way to import static sites and was thinking of writing one similar to your >>>> proposed challenge. >>>> >>>> Do you know if anyone did produce a functional solution? I see this >>>> thread is from nearly three years ago and am not sure what the current >>>> state of play is. >>>> >>>> Best, Tim Spear >>>> >>>> >>>> >>>> >>>> On Wednesday, November 24, 2010 8:05:21 PM UTC, mdipierro wrote: >>>>> >>>>> I have a challanage: >>>>> >>>>> write a script that takes a folder that contains a static html file >>>>> and converts it into an HTML site. >>>>> >>>>> 1) moves all non .html files into static/ >>>>> 2) moves all .html files into views/xxx/ >>>>> 3) creates a controllers/xxx.py and for each yyy.html file add an >>>>> action >>>>> >>>>> def yyy(): return dict() >>>>> >>>>> 4) loop over all .html files and fixes all the URL to {{=URL(...)}}} >>>>> >>>>> OPTIONAL: >>>>> 5) >>>>> If all .html files start with a similar header and footer, tried to >>>>> identify them, moves "<header>{{include}}<footer>" into views/ >>>>> layout.html and rewrite the html files to {{extend 'layout.html'}} >>>>> >>>>> The original folder and 'xxx' should be uer defined. This could be >>>>> added to the wizard. >>>>> >>>>> Massimo >>>> >>>> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.