Package omeroweb :: Module manage
[hide private]
[frames] | no frames]

Source Code for Module omeroweb.manage

 1  #!/usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3  #  
 4  #  
 5  #  
 6  # Copyright (c) 2008 University of Dundee.  
 7  #  
 8  # This program is free software: you can redistribute it and/or modify 
 9  # it under the terms of the GNU Affero General Public License as 
10  # published by the Free Software Foundation, either version 3 of the 
11  # License, or (at your option) any later version. 
12  #  
13  # This program is distributed in the hope that it will be useful, 
14  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16  # GNU Affero General Public License for more details. 
17  #  
18  # You should have received a copy of the GNU Affero General Public License 
19  # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
20  #  
21  # Author: Aleksandra Tarkowska <A(dot)Tarkowska(at)dundee(dot)ac(dot)uk>, 2008. 
22  #  
23  # Version: 1.0 
24  # 
25   
26  import sys 
27  import logging 
28   
29  from django.core.management import execute_manager 
30   
31  logger = logging.getLogger(__name__) 
32   
33  try: 
34      import settings # Assumed to be in the same directory. 
35  except ImportError: 
36      logger.error("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) 
37      sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) 
38      sys.exit(1) 
39   
40  if __name__ == "__main__": 
41      from omero.util import configure_logging 
42      if settings.DEBUG: 
43          configure_logging(settings.LOGDIR, 'OMEROweb.log', loglevel=logging.DEBUG) 
44       
45      logger.info("Application Starting...")     
46      execute_manager(settings) 
47