How can I import models and views from Django Site1 to Site2 using the Sites Framework?
Django Sites Framework scenario
top
----site1
----site2
----media
#File on Site 2: views.py
from site1.article.models import Model1, Model2
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Django’s sites framework is about sharing the same code on different sites (in the end different Django instances with one codebase and one database).
Your directory structure suggests that you are doing it wrong: you should not have multiple site apps, putting your stuff in site1 and importing it into other site apps.
Instead you should code your Django Apps with the help of the sites framework:
SITE_IDinsettings.pySite.objects.get_current()You can do this in elaborate ways (Model inheritance, custom Managers for automatic filtering), but this is the basic description.