Yes, it's silly question.
I've added empty file "__init__.py" to folder "controller"
\controller\index.py (has class IndexPage)
\controller\portfolio.py (has class PortfolioPage)
now I get other error:
*<type 'exceptions.NameError'>*: name 'IndexPage' is not defined
args = ("name 'IndexPage' is not defined",)
message = "name 'IndexPage' is not defined"
So, module is ready, but my classes are not visible.
What do I have to do next to make them visible?
2009/3/14 Serega.Sheypak <[email protected]>
> Hi, I'm new to Python and have problems with import script files.
> Please help me to overcome it.
> Here is structure of my application:
>
> #########################
> \
> \main.py
> \app.yaml
> \controller
> \controller\index.py (has class IndexPage)
> \controller\portfolio.py (has class PortfolioPage)
> \html\some_views_for_controllers
> \img\some_images
> \css\some_css
>
> Here is my app.yaml:
> #####################
> application: supercoolapp
> version: 1
> runtime: python
> api_version: 1
>
> handlers:
> - url: /css
> static_dir: css
> - url: /img
> static_dir: img
> - url: /.*
> script: main.py
>
> here is main.py code:
> #####################
> from google.appengine.ext import webapp
> from google.appengine.ext.webapp.util import run_wsgi_app
> from controller import *
>
>
> # MAIN CONFIGURATION #
> # Register the URL with the responsible classes
> application = webapp.WSGIApplication([ ('/', IndexPage), ('/
> portfolio', PortfolioPage) ], debug=True)
>
> # Register the wsgi application to run
> def main():
> run_wsgi_app(application)
>
> if __name__ == "__main__":
> main()
>
> And I get exception whilr trying to see first page of my app:
>
> 2 from google.appengine.ext.webapp.util import run_wsgi_app
> 3 from controller import *
> 4
> 5
> 6 # MAIN CONFIGURATION #
> controller undefined
>
> <type 'exceptions.ImportError'>: No module named controller
> args = ('No module named controller',)
> message = 'No module named controller'
>
> So it tells me that there is no module.
> I've read this thing:
> http://docs.python.org/tutorial/modules.html#importing-from-a-package
>
> What do I do wrong? Please tell me.
>
> Sorry for stupid question.
>
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" 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/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---