Re: How to execute some user defined codes (functions) when Django boot?

2010-08-18 Thread Graham Dumpleton
On Aug 18, 6:31 pm, Mathieu Leduc-Hamel wrote: > Richard, > > it's not the good way to do this, in the settings.py cause as i said before, > the code in the settings.py is executed every time somebody initiate a > session for the first time. The point there is a way to have a part of code > comm

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-18 Thread Tang Daogang
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 'se

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-18 Thread Tang Daogang
Emm, this may another way to reach it, I'll consider it. On 8月18日, 下午10时06分, skyjur wrote: > You could try to create an app with models.py file and put your calls > in models.py. Then register your app in installed apps, above all > other apps. > > source:http://stackoverflow.com/questions/261008

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-18 Thread Tang Daogang
Hi, Emily, I am very glad to share my design with all, but I want to show it when it can work. So let me inspect it for more days, I will introduce my design for you later. Thanks for your careness. On 8月18日, 下午6时18分, Emily Rodgers wrote: > Hi, > > I still don't really understand what you are t

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-18 Thread Tang Daogang
Hi, Emily, I am very glad to share my design with all, but I want to show it when it can work. So let me inspect it for more days, I will introduce my design for you later. Thanks for your careness. On 8月18日, 下午6时18分, Emily Rodgers wrote: > Hi, > > I still don't really understand what you are t

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-18 Thread Tang Daogang
Sounds good idea. I'll try it. On 8月18日, 下午3时04分, Richard Colley wrote: > Why not call your "boot" code from settings.py? > > On Aug 18, 4:05 pm, Tang Daogang wrote: > > > > > hi, Emily, > > > Let me introduce Scala/Lift as example. > > > Every lift project has a file named 'Boot.scala', this fi

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-18 Thread Tang Daogang
Mathieu, Thanks for you continuous attention. I will try twod.wsgi as a scheme later. On 8月18日, 下午4时31分, Mathieu Leduc-Hamel wrote: > Richard, > > it's not the good way to do this, in the settings.py cause as i said before, > the code in the settings.py is executed every time somebody initiate

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-18 Thread Daniel Roseman
On Aug 18, 7:05 am, Tang Daogang 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 user

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-18 Thread Mathieu Leduc-Hamel
The problem with that way, as said before is that you don't really know if your code will be executed at startup in the wsgi context... and exactly at what time. 2010/8/18 skyjur > You could try to create an app with models.py file and put your calls > in models.py. Then register your app in ins

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-18 Thread skyjur
You could try to create an app with models.py file and put your calls in models.py. Then register your app in installed apps, above all other apps. source: http://stackoverflow.com/questions/2610088/can-djangos-auth-user-username-be-varchar75-how-could-that-be-done On Aug 18, 1:18 pm, Emily Rodg

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-18 Thread Emily Rodgers
Hi, I still don't really understand what you are trying to do, but it sounds like Mathieu does and has offered you some pretty useful advice. If his link below helps you fix what you are trying to do, please let us know what you did (this is really useful for others with the same problem), and if

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-18 Thread Mathieu Leduc-Hamel
Richard, it's not the good way to do this, in the settings.py cause as i said before, the code in the settings.py is executed every time somebody initiate a session for the first time. The point there is a way to have a part of code common to all currently connected user. Tang, I'm not an expert

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-18 Thread Richard Colley
Why not call your "boot" code from settings.py? On Aug 18, 4:05 pm, Tang Daogang 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 so

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Kenneth Gonsalves
On Tue, 2010-08-17 at 23:05 -0700, Tang Daogang wrote: > 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

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Tang Daogang
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 o

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Tang Daogang
Mathieu, What you said prompt me some idea: If I write my plugin registering codes into a middleware, and load it in django's settings.py, will it executed when app boot up? On 8月17日, 下午11时51分, Mathieu Leduc-Hamel wrote: > Paul, no it's not exactly the point. When you said some code on the boot

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Mathieu Leduc-Hamel
Paul, no it's not exactly the point. When you said some code on the boot up it means really a piece of code shared by everyone and executed just one time, by example, for mod_wsgi it would be when apache is starting. That's exactly what's done in the Pylons world to be able to load some piece of c

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Paul Winkler
Seems to me that "on boot up" doesn't mean anything in a shared- nothing architecture like Django's. For example if you deploy on eg. mod_wsgi. You have no idea how long any particular thread or process is going to live, and no idea how often this "boot" code would get run. But assuming that's OK

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Mathieu Leduc-Hamel
Tang, do you mean : "How to execute some pieces of code when you launch the "runserver" command by example" ? If this is what you mean, it's not a easy thing to do right now. Then only way i found it possible is by using: twod.wsgi With twod.wsgi you can use the entry points system of python and

Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Emily Rodgers
On Aug 17, 2:26 am, Tang Daogang wrote: > Dear all, > > Recently, I have developed a plugin system for my app, and I want to > register those plugins when my app boot up, this need to execute some > user defined codes (functions) in app boot procedure, I don't know > where insert my registering co

How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Tang Daogang
Dear all, Recently, I have developed a plugin system for my app, and I want to register those plugins when my app boot up, this need to execute some user defined codes (functions) in app boot procedure, I don't know where insert my registering codes to, anyone can help? Thank you. -- You receiv