On May 21, 10:37 pm, puff <[EMAIL PROTECTED]> wrote: > As part of startup, the application needs to initialize itself from a > number of external applications. We've Googled the issue and it > appears that it is reasonable to do this initialization by putting > code in startup.py. Is this the case? When is startup.py executed by > Django? Under what conditions, if any, will it be re-executed?
Depending on the hosting mechanism has been configured, any Django startup may only happen the first time a request comes in. This would potentially delay requests if the initialisation takes a while. You may need to look at the hosting mechanism being used to see if it has a means of loading code and performing actions when processes are first loaded. This can still result in requests being delayed in certain circumstances but impact is otherwise a lot less. > Part of the application involves running an external application on a > scheduled basis. Our tentative approach is to use cron to post a URI > to cause Django to start the external application. Apache is a multiproces web server. Does it matter that your request is going to only one of the possible many processes which may be running? Do note it is possible to write standalone scripts that import your Django instance and thus allow you to do stuff on the database outside of the context of an Apache process. So, do you really need it to be done inside the context of a running Apache process? > What, if any, issues are there with a daemon like process running > within Django/Apache? Do you mean a daemonised thread running in Apache processes? Running Django under Apache is not an issue, so not sure if you mean something else. > It seems likely that parts of our application will want to be > threaded. What, if any, issues are there with threading within Django/ > Apache? There is unfortunately no definitive answer to that. Although people use Django on Apache winnt and worker MPMs, plus with multithreaded fastcgi configurations, there is no guarantee that Django is thread safe. > Any insight that the group might provide will be greatly appreciated > as these are rather critical architectural questions that impact how > we will use Django and the overall design of our application. You may perhaps want to split out any long running activities from the Django processes running in Apache into a separate backend server independent from Apache. That backend process can be a true long running process, where as with processes under Apache, they can be recycled by Apache which may be an issue where an activity is interrupted. Graham --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---