Changes between Version 39 and Version 40 of IrcFAQ


Ignore:
Timestamp:
Jun 17, 2007, 12:54:39 AM (17 years ago)
Author:
James Bennett
Comment:

question about server/app startup

Legend:

Unmodified
Added
Removed
Modified
  • IrcFAQ

    v39 v40  
    129129
    130130Feisty Fawn ships with Python 2.5.1-c1. Just run {{{apt-get update}}} and {{{apt-get install python2.5}}} should fix those problems.
     131
     132== I want to have some code run when the server/application starts. How do I do that? ==
     133
     134Both mod_python and FastCGI are structured in such a way that there's no such thing as "application startup" or "server startup"; the best solution is to place your "startup" code somewhere that's guaranteed to be imported early on in the request/response cycle (the `__init__.py` file of your project, or of a specific application you're using, can be a good place, because Python will execute code found there the first time it has to import the module; just be aware that referencing the same module in different ways, say by doing `from myproject.myapp import foo` in one place, and `from myapp import foo` in another, will cause that code to be executed once for each different way you import it).
Back to Top