Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django DDP assistance

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.

like image 836
Dean Christian Armada Avatar asked Jan 26 '26 00:01

Dean Christian Armada


1 Answers

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.

like image 54
Cody Parker Avatar answered Jan 27 '26 13:01

Cody Parker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!