import datetime, sys, os, logging
os.environ['DJANGO_SETTINGS_MODULE'] = 'YourDirectoryThatContainsTheSettingsModule.settings'
If it's running elsewhere you'll need to do more with path manipulation, but I did not pursue that.
I also created an option for >python manage.py myoption but I had to copy that into django.core to get it to work due to my lack of knowledge and I got the above working before putting more effort into alternatives.
-----Original Message-----
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Mike Ramirez
Sent: Friday, March 25, 2011 9:23 PM
To: django-users@googlegroups.com
Subject: Re: How to run a file.py in the django environement
On Friday, March 25, 2011 06:06:39 pm José António Silva wrote:
> Is there any command like
> python manage.py shell filename.py (I know this particular command
> isn't allowed, but is there any other?)
>
> thanks,
> JA
how about turning filename.py into a django command?
http://docs.djangoproject.com/en/dev/howto/custom-management-commands/
Mike
--
Paranoid Club meeting this Friday. Now ... just try to find out where!
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment