1

I have a file structure like so:

app.yaml something/ __init__.py models.py test.py 

I have URL set up to run tests.py in app.yaml:

... - url: /test script: something/test.py 

test.py imports models.py

When I try to navigate to http://myapp.appspot.com/test/ I get the following error:

Error: Server Error The server encountered an error and could not complete your request. If the problem persists, please report your problem and mention this error message and the > query that caused it

And, when I check the logs on the dashboard I see the following error occurred:

<type 'exceptions.ImportError'>: No module named models 

How do I import the file properly?

Cheers,

Pete

2
  • 1
    if you could show us your code - we might spot something you may be missing. Commented Nov 20, 2010 at 23:48
  • What happens when you run the app in the SDK? Commented Nov 21, 2010 at 1:08

3 Answers 3

1

inside test.py you can write at the top something like:

from something.models import * 

This will import your models. For corrective code though - the wildcard '*' is not great and you explicitly import the models your using:

from something.models import ModelName, OtherModel 

and so on.

Sign up to request clarification or add additional context in comments.

Comments

1

test.py should have imports models, not imports models.py

Comments

0

Try to import models like this:

import something.models as models 

Comments