You can also do this:
from app.test import test
urls = ('/', 'test')
That way, if you rename app.test to app.somethingelse, you would only
have to change one line:
from app.somethingelse import test
and the rest of the code will just work.
2010/4/29 vlatko <[email protected]>:
> Yes I wasn't sure about __init__.py but this solved my problem.
> I simple put this empty file into app directory and now works.
> Now i am experimenting about app.test , or app.test.test -> i put test
> class into test.py
> and works good, so when i have urls= ('/', 'app.test.test' ) in app
> folder in test.py i have class test.
>
> Thanks very much
>
>
>
> On Apr 28, 9:42 pm, Branko Vukelic <[email protected]> wrote:
>> That's actually a python question. You should first create an empty
>> ``__init__.py`` file in the ``app`` dir, and then do
>>
>> import app.test
>>
>> app.test means one of the following:
>>
>> 1. app directory that contains a file called test.py
>> 2. app.py which contains something called test
>> 3. app directory that contains a test directory and test contains
>> empty __init__.py
>> 4. (I'm not sure about this) __init__.py in app dir contains something
>> called test.
>>
>> In your case, it's number 1.
>>
>>
>>
>> On Wed, Apr 28, 2010 at 7:43 PM, vlatko <[email protected]> wrote:
>> > Why i cant make this to work
>> > i have folder 'app' and inside folder i have file 'test.py'
>> > what is the procedure to make this work like application.
>> > when i put 'import app.controllers' shows error 'no module
>> > app.controllers'
>> > How i can make subdirectories to call like MVC and this to work.
>> > My webpy library is in folder inside my application and i call 'web'
>> > with
>> > symlinks .
>> > Folder structure:
>> > /PROJECT/
>> > /app/test.py
>> > /webpy/
>> > code.py
>> > settings.py
>>
>> > and in code.py i have:
>> > import os
>> > import web
>> > from settings import *
>> > import app.controllers ---> ERROR "no module app.controllers"
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "web.py" group.
>> > To post to this group, send email to [email protected].
>> > To unsubscribe from this group, send email to
>> > [email protected].
>> > For more options, visit this group
>> > athttp://groups.google.com/group/webpy?hl=en.
>>
>> --
>> Branko Vukelić
>>
>> [email protected]
>> [email protected]
>>
>> Check out my blog:http://www.brankovukelic.com/
>> Check out my portfolio:http://www.flickr.com/photos/foxbunny/
>> Registered Linux user #438078 (http://counter.li.org/)
>> I hang out on identi.ca:http://identi.ca/foxbunny
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "web.py" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group
>> athttp://groups.google.com/group/webpy?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/webpy?hl=en.
>
>
--
Branko Vukelić
[email protected]
[email protected]
Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.