Reputation: 3015
I run Django through a Python 3.4 virtualenv and I want to make some cronjob scripts that will access models and save.
I can do this through the Django shell python manage.py shell
will initiate the Django shell. From there I can do from polls.models import Poll, Choice
and make a new Poll and save it into the DB.
How can I do this through the regular Python shell?
Upvotes: 1
Views: 436
Reputation: 76
Your best bet is probably to create a management command. You can run it from the command line by calling (python manage.py ) and from within the script you can access any django functions or models.
For further instructions on how see here https://docs.djangoproject.com/en/dev/howto/custom-management-commands/
Upvotes: 3