[Fixed]-How to access Models.py from external py script?

1👍

There are a few lines you need to include in your script if you want to use Django in “standalone” mode. See the documentation here: https://docs.djangoproject.com/en/1.10/topics/settings/#calling-django-setup-is-required-for-standalone-django-usage .

Another option would be to turn your script into a Django management command which you would then call with manage.py.

Leave a comment