문제

I'm writing in python for google app engine. When i compile my project it gets not error. When I use it on the server I get error on the import.

For example I am importing a method from another class like this:

from src.receiver.receive_smth import add_to_smth_db

The error I get looks like this:

<type 'exceptions.ImportError'>: No module named src.receiver.receive_smth

The weird thing is that when I automatically import this dependency I get something like:

from receiver.receive_smth import add_to_smth_db

(notice that the src is missing in front of the receiver), however my project is marked with errors.

Google appengine imports and django work fine besides a warning that

You are using the default Django version (0.96). The default Django version will change in an App Engine release in the near future.

[Update]

One thing I noticed is that my packages do not contain __init__.py scripts (I am working on windows). Any ideas on how to configure packages properly?

Warning regarding Django version fixed

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from google.appengine.dist import use_library
use_library('django', '1.1')

올바른 솔루션이 없습니다

다른 팁

This is because you IDE can add your project to python sys path on your system. Or framework can do that then you setup your project. Try to use realitive import http://www.python.org/dev/peps/pep-0328/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top