[Answer]-Django import project.app vs import app

0đź‘Ť

âś…

Per the date, I think you’re using newest django 1.4, which has a new layout when you typed “django-admin.py startproject” and “django-admin.py startapp”.

https://docs.djangoproject.com/en/1.4/releases/1.4/#updated-default-project-layout-and-manage-py

👤Edward Liang

1đź‘Ť

from catalog.models import Product is fine, and i think it’s better than the example. Because if you want to use the app, you have to change every single import statement where you use your project name. Don’t do from myproject.myapp.models import MyModel, it’s a bad practice, if you’re sure that the models you importing is in the same directory, i think this one is the best : from models import Product, else from myapp.models import MyModel

Leave a comment