3

I'm sorry for this question I am not yet an expert to both django and meteorjs. I am trying to use this django-ddp technology but I am a little stuck on "Start the Django DDP service" on the Example Usage instruction at https://github.com/commoncode/django-ddp

I created a virtualenv,
I created a project named tutorial,
I followed the example usage instructions from the start until,
Every time I tried to run this command (DJANGO_SETTINGS_MODULE=tutorial.settings dddp) in shell I always get a response of "ImportError: No module named tutorial.settings"

P.S.: I even tried to package the project dir but still no luck.

Dean Christian Armada
  • 6,724
  • 9
  • 67
  • 116

1 Answers1

3

It would seem the issue is that your project isn't on the PYTHONPATH.

I had this issue when I wanted to set DDDP to be called from a executable python file. So, I created a file called run_dddp.py and added this:

#!/usr/bin/env python
import os
import subprocess

if __name__ == "__main__":
    new_env = os.environ
    new_env['PYTHONPATH'] = '/path/to/your/project'
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tutorial.settings")
    subprocess.call(['dddp'], env=new_env)

That adds the location of your project to the path and passes it to dddp.

I suppose you could also just modify the dddp exectuable and add in sys.path.append(/path/to/your/project) there as well or just add it to the path before calling DDDP every time, too. But the file above was just easier for me.

Cody Parker
  • 1,111
  • 6
  • 10