[Twisted-Python] Question regarding widgets

Alex spam at polynode.com
Tue Nov 5 19:33:15 MST 2002


At 09:12 AM 11/6/2002 +0800, lals;dfjsd wrote:
>Ummm so does that mean I have to add something to the pythonpath for a web 
>application that I am building in a particular directory ?

I think I know what Mr. Dfjsd is getting at; I hit this same problem.

If you're building an app in c:\webapp, and you run twistd from that 
directory, then 'c:\webapp' should be part of sys.path.  The reason for 
this is that '.' is part of sys.path, and if you're running twistd in 
c:\webapp, then '.' == 'c:\webapp'.  So, if:

   c:\webapp\docroot contains your HTML files and RPY files
   c:\webapp\my_app contains any Python code you need to import

...and you run:

   c:\webapp> mktap web --path docroot
   c:\webapp> twistd -f web.tap

...if you have a .rpy in c:\webapp\docroot, it can call 'import my_app' and 
it should work fine.  (Provided c:\webapp\my_app\__init__.py exists.)

Does that answer your question?

(All twisted.web.woven gurus: feel free to comment or correct me. :)

--
Alex Levy
WWW: http://mesozoic.geecs.org
Tel: 617.835.0778

"Never let your sense of morals prevent you from doing what is right."
-- Salvor Hardin, Isaac Asimov's _Foundation_






More information about the Twisted-Python mailing list