Dear Daniel,

I must admit that I am a fresh man in Django developement, so there's
indeed many concepts and procedures not clear to me, I was affected by
J2EE's concepts heavily.

I am ready to inspect which.py files will be executed automatically
when an app start up, till now what I know are 'settings.py',
'models.py', urls.py', 'admin.py'. I will dive into it now. If you
have any matierials or advices on it, please share them to me.

Later I will give out my code here.

Thank you.

On 8月18日, 下午10时24分, Daniel Roseman <[email protected]> wrote:
> On Aug 18, 7:05 am, Tang Daogang <[email protected]> wrote:
>
>
>
>
>
> > hi, Emily,
>
> > Let me introduce Scala/Lift as example.
>
> > Every lift project has a file named 'Boot.scala', this file will only
> > be executed once when this project boots up. In this file, we can
> > write some initial codes to initial project and some userdefined
> > structures.
>
> > Emm, that's it. I want to find one file acting like Boot.scala of Lift
> > within Django, but failed. If there is one file like that, I will put
> > my plugins registering codes into it, thus, when I type "python
> > manage.py runserver", it can be executed automatically and only once.
> > By it, my plugins can be registered when app boot up.
>
> > Do you understand my meaning? Welcome suggestion.
>
> But you still haven't understood that a Django website served by eg
> Apache is different from a standalone single-process application like
> your Scala example. There's simply no such thing as 'at bootup',
> because Apache will dynamically create and kill processes as required
> by website load. In many configurations, those processes are
> independent and do not share state with each other.
>
> So, do you really want something that is only run once - by the
> initial process that is created on server startup? If so, any in-
> memory structures that it creates would not be accessible by other
> processes that are started later. This might be what you want if the
> data is persisted to disk or the database, so you really do only want
> it created once.
>
> Or, do you want a process to set up in-memory structures for itself
> when it starts, which then persist inside that process for the
> duration of that process? In which case, you might try putting
> something into urls.py so it is run when that module is imported,
> which is the way that the admin is set up via admin.autodiscover().
> --
> DR.- 隐藏被引用文字 -
>
> - 显示引用的文字 -

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to