From: Jonathan T. <jon...@ut...> - 2005-05-11 05:37:46
|
Hi, I am trying to figure out how ppl usually organize a spyce project with .spy, .spi and .py files. I have been getting by for the last 6 months with various amounts of hackery. I have something like this so far: project - wwwroot - src - lib I was thinking of putting spy in wwwroot, spi in src, and py in lib and then soft link project/wwwroot to a web accessible dir such as ~/public_html/project. I seem to be able to access the .spi by: [[.include file="../src/output_fns.spi"]] [[.include file="../config.spi"]] And I am trying to get config.spi to somehow add the absolute path of lib to sys.path so that I can access these .py modules in any .spy file in the wwwroot. This seems easier said then done. I think I can get the path by os.path.realpath(request.path()) and stripping off the end. Is there an easier way? I know this will break for a file in wwwroot/someextradir/ since I would then have to break off more. I'd be interested in hearing any suggestions for doing what I am doing. More importantly, am I making this harder than it is? Is there some simple organization I am not thinking of? All in one dir seems like a good idea to me but then ppl can download my .py and .spi files possibly getting db passwords etc. Bah.. ;) Thanks for any pointers. Jon. P.S. Kudos to Jonathan Ellis for the great work recently. |
From: Jonathan E. <jon...@si...> - 2005-05-11 15:17:07
|
Jonathan Taylor wrote: > Hi, > > I am trying to figure out how ppl usually organize a spyce project with > .spy, .spi and .py files. I have been getting by for the last 6 months > with various amounts of hackery. > > I have something like this so far: > > project > - wwwroot > - src > - lib > > I was thinking of putting spy in wwwroot, spi in src, and py in lib and > then soft link project/wwwroot to a web accessible dir such as > ~/public_html/project. > > I seem to be able to access the .spi by: > > [[.include file="../src/output_fns.spi"]] > [[.include file="../config.spi"]] > > And I am trying to get config.spi to somehow add the absolute path of > lib to sys.path so that I can access these .py modules in any .spy file > in the wwwroot. This seems easier said then done. I think I can get > the path by os.path.realpath(request.path()) and stripping off the end. With spyce 2, all you would do is sys.path.append(os.path.join(root, 'lib')) after you define root in spyceconf.py. > I'd be interested in hearing any suggestions for doing what I am doing. > More importantly, am I making this harder than it is? wrt request.path, yes :) > Is there some > simple organization I am not thinking of? All in one dir seems like a > good idea to me but then ppl can download my .py and .spi files possibly > getting db passwords etc. Bah.. ;) Well, it depends how big your app gets -- all in one dir starts to get messy past a couple dozen files. SilentWhistle is organized pretty much the way you describe. (If you wanted to go the simple route, you could use mod_access to keep people out of your .spi and .py files.) > P.S. Kudos to Jonathan Ellis for the great work recently. Thanks! -Jonathan |
From: Jonathan T. <jon...@ut...> - 2005-05-11 23:20:55
|
Jonathan Ellis wrote: > Jonathan Taylor wrote: > >> Hi, >> >> I am trying to figure out how ppl usually organize a spyce project >> with .spy, .spi and .py files. I have been getting by for the last 6 >> months with various amounts of hackery. >> >> I have something like this so far: >> >> project >> - wwwroot >> - src >> - lib >> >> I was thinking of putting spy in wwwroot, spi in src, and py in lib >> and then soft link project/wwwroot to a web accessible dir such as >> ~/public_html/project. >> >> I seem to be able to access the .spi by: >> >> [[.include file="../src/output_fns.spi"]] >> [[.include file="../config.spi"]] >> >> And I am trying to get config.spi to somehow add the absolute path of >> lib to sys.path so that I can access these .py modules in any .spy >> file in the wwwroot. This seems easier said then done. I think I can >> get the path by os.path.realpath(request.path()) and stripping off the >> end. > > > With spyce 2, all you would do is > sys.path.append(os.path.join(root, 'lib')) > > after you define root in spyceconf.py. > >> I'd be interested in hearing any suggestions for doing what I am >> doing. More importantly, am I making this harder than it is? > > > wrt request.path, yes :) > >> Is there some simple organization I am not thinking of? All in one >> dir seems like a good idea to me but then ppl can download my .py and >> .spi files possibly getting db passwords etc. Bah.. ;) > > > Well, it depends how big your app gets -- all in one dir starts to get > messy past a couple dozen files. SilentWhistle is organized pretty much > the way you describe. > > (If you wanted to go the simple route, you could use mod_access to keep > people out of your .spi and .py files.) > >> P.S. Kudos to Jonathan Ellis for the great work recently. > > > Thanks! > > -Jonathan > > > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click > _______________________________________________ > Spyce-users mailing list > Spy...@li... > https://lists.sourceforge.net/lists/listinfo/spyce-users > About spyceconfig.py, how do you use this? Is their some docs I couldnt find? My hope was to have this application work without any need to reconfigure apache. That is a normal user could set it up in her home directory public_html and have it work assuming spyce was installed. Does spyceconfig.py facilitate this? Thanks. Jon. |
From: Jonathan E. <jon...@si...> - 2005-05-13 04:07:28
|
Jonathan Taylor wrote: > About spyceconfig.py, how do you use this? Is their some docs I couldnt > find? No, it's spyceconf.py in the main directory in spyce 2.0. > My hope was to have this application work without any need to > reconfigure apache. That is a normal user could set it up in her home > directory public_html and have it work assuming spyce was installed. > Does spyceconfig.py facilitate this? Assuming the normal user is capable of modifying spyceconf.py or a copy of it (with the --conf option) then yes. -Jonathan |