Search code examples
pythondjangoprojectotree

Can I pass data through two different django projects?


After an otree survey, I start with subprocess another django app, specially a django-oscar shop. It runs on another port. Now, I want to pass some data from the survey (first app, otree) to the shop (second app, django-oscar).

I tried this in app2/views.py:

from survey.models import Player

class CatalogueView(TemplateView):
    """
    Browse all products in the catalogue
    """
    model = Player
    context_object_name = "products"
    template_name = 'catalogue/browse.html'

But I just get this error:

ModuleNotFoundError: No module named 'otree'

I also tried to import otree.api and I put otree to installed_apps.

Any ideas, how to handle this?


Solution

  • Solved this a little differently. I have waived the sub processes and have created an API with django REST framework instead. Passing parameters back and forth were imho the best approach.