Joe Gillon
Joe Gillon

Reputation: 97

Python/Django - cannot import my own models.py

This is ridiculous. My folders:

eVistA
--manage.py
--evista
----__init__.py
----settings.py
----urls.py
----wsgi.py
--fms
----__init__.py
----models.py
----tests.py
----views.py
----features
------__init__.py
------funding.feature
------funding.py

In funding.py I have

from fms.models import *

When I run lettuce I get:

ImportError: No module named fms.models 

Gonna have to shoot myself.


Just for laughs I put a copy of models.py in the features folder and now

from models import *

results in

ImportError: Settings cannot be imported, because environment variable DJANGO_SE
TTINGS_MODULE is undefined. 

In manage.py I have

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "evista.settings")

Upvotes: 0

Views: 335

Answers (2)

Joe Gillon
Joe Gillon

Reputation: 97

I seem to be in business with:

from fms.models import *

Seems you don't run lettuce with Django, you have to run:

python manage.py harvest

From the top folder that contains manage.py of course.

Upvotes: 1

leonsas
leonsas

Reputation: 4898

Try with

from evista.fms.models import *

Upvotes: 0

Related Questions