简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM