You can "touch" one of the .py files.  That is, cause its last modified
date to become newer than that of its .pyc file by making it the current
time.

I suspect that you can do this (assuming that you don't want to run the
*nix "touch" command as a sub process, or don't have it because you
are on an OS that doesn't have it) by opening the file for writing, not
writing to it, and closing it again.  But note that I haven't tested this on
any platform, let alone yours.

The development server is actually two processes: the one you start
with manage, and the one actually running Django, which is started by
the first "driver" process.  The driver process then spends its time
watching for files to change, and when it sees one do so, it restarts
the server process.  However you can manage to implement touch on
your platform.

Note that this is specific to the development server.  But note that mod_wsgi
has a similar watch upon just the .wsgi file (which doesn't have to be
named with .wsgi, it's just the one that the WSGIScripAlias points to).

On 4/23/12, dummyman dummyman <tempo...@gmail.com> wrote:
> basically i ve a form in a class CollFormAdmin where i am overriding two
> fields to MultipleChoiceField where values are changed dynamically based on
> a pickle file value
> then in CollAdmin class
>
>
> class CollAdmin(admin.ModelAdmin):
>
>    form=CollFormAdmin
>
> but i want to change the value of MultipleChoiceField dynamically. But it
> appears like the class is loaded only once and the form is taking the
> previous old value ie d first one. Thats y i asked a way to restart the
> server in the code
>
> please help me
>
>
> On Mon, Apr 23, 2012 at 8:35 PM, dummyman dummyman
> <tempo...@gmail.com>wrote:
>
>> hi
>>
>> but how do i do it when the server is running ??
>> i basically want to stop it and restart it in the program
>> is it possible ?
>>
>> On Mon, Apr 23, 2012 at 6:54 PM, Joel Goldstick
>> <joel.goldst...@gmail.com>wrote:
>>
>>> On Mon, Apr 23, 20ogr12 at 9:16 AM, Joel Goldstick
>>>
>>> <joel.goldst...@gmail.com> wrote:
>>> > On Mon, Apr 23, 2012 at 6:10 AM, dummyman dummyman <tempo...@gmail.com>
>>> wrote:
>>> >> how to restart a django development server programmatically in python
>>> >> ?
>>> >>
>>> >> --
>>> >> 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+unsubscr...@googlegroups.com.
>>> >> For more options, visit this group at
>>> >> http://groups.google.com/group/django-users?hl=en.
>>> >
>>> > python manage.py runserver
>>> >
>>> oops I spoke too soon.  Didn't see you want to do this
>>> programatically.  But I suppose you could just invoke that line using
>>> subprocess?
>>> http://docs.python.org/library/subprocess.html#module-subprocess
>>> > --
>>> > Joel Goldstick
>>>
>>>
>>>
>>> --
>>> Joel Goldstick
>>>
>>> --
>>> 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+unsubscr...@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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to