[Answer]-Django CLI script and database router: cannot import name connections

1👍

my script was in the same folder with settings.py
when I moved it from /hosting/myproject/myproject/parser_jobs.py to /hosting/myproject/parser_jobs.py (where in django1.4 manage.py should be) it become working correct.

Also I changed os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") to os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")

And now it works!

In previous location parser_jobs.py works only without db router

Leave a comment