def main(set_apps_path=True): if set_apps_path: # Add local apps path. apps_path = os.path.split(os.path.abspath(__file__))[0] if apps_path not in sys.path: sys.path.append(apps_path) if len(sys.argv) >= 2: options = sys.argv[2:] init_options = {} if '--skip-cloudmade-key' in options: init_options = { 'skip_cloudmade_key': True, } else: init_options = { 'skip_cloudmade_key': False, } if sys.argv[1] == 'setup_all': # We have to special-case this commands, it happens before the # install's localsettings.py is installed, so the usual django # management machinery will throw errors about settings not # being set yet. But after we have run the setup commands we # let it fall through to the normal django method. if not os.path.exists(os.path.join(DATA_ROOT, 'conf')): init_data_dir.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) init_db.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) init_settings.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT, **init_options) else: print "Existing localwiki data directory found! Using %s\n" % DATA_ROOT if len(sys.argv) >= 2: if sys.argv[1] == 'init_data_dir': init_data_dir.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) return if sys.argv[1] == 'init_db': init_db.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) return if sys.argv[1] == 'init_settings': init_settings.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT, **init_options) return os.environ.setdefault("DJANGO_SETTINGS_MODULE", "main.settings") execute_from_command_line(sys.argv)
def main(set_apps_path=True): if set_apps_path: # Add local apps path. apps_path = os.path.split(os.path.abspath(__file__))[0] if apps_path not in sys.path: sys.path.append(apps_path) if len(sys.argv) >= 2: options = sys.argv[2:] init_options = {} if '--skip-cloudmade-key' in options: init_options = {'skip_cloudmade_key': True,} if sys.argv[1] == 'setup_all': # We have to special-case this commands, it happens before the # install's localsettings.py is installed, so the usual django # management machinery will throw errors about settings not # being set yet. But after we have run the setup commands we # let it fall through to the normal django method. if not os.path.exists(os.path.join(DATA_ROOT, 'conf')): init_data_dir.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) init_db.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) init_settings.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT, **init_options) else: print "Existing localwiki data directory found! Using %s\n" % DATA_ROOT if len(sys.argv) >= 2: if sys.argv[1] == 'init_data_dir': init_data_dir.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) return if sys.argv[1] == 'init_db': init_db.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) return if sys.argv[1] == 'init_settings': init_settings.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT, **init_options) return try: import settings # Assumed to be in the same directory. except ImportError: 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__) sys.exit(1) execute_manager(settings)
def main(set_apps_path=True): if set_apps_path: # Add local apps path. apps_path = os.path.split(os.path.abspath(__file__))[0] if apps_path not in sys.path: sys.path.append(apps_path) if len(sys.argv) >= 2 and sys.argv[1] == "setup_all": # We have to special-case this commands, it happens before the # install's localsettings.py is installed, so the usual django # management machinery will throw errors about settings not # being set yet. But after we have run the setup commands we # let it fall through to the normal django method. if not os.path.exists(os.path.join(DATA_ROOT, "conf")): init_data_dir.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) postgres = "postgres" in sys.argv init_db.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT, POSTGRES=postgres) solr = "solr" in sys.argv init_settings.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT, SOLR=solr) else: print "Existing EditKit data directory found! Using %s\n" % DATA_ROOT if len(sys.argv) >= 2: if sys.argv[1] == "init_data_dir": init_data_dir.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) return if sys.argv[1] == "init_db": postgres = "postgres" in sys.argv init_db.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT, POSTGRES=postgres) return if sys.argv[1] == "init_settings": solr = "solr" in sys.argv init_settings.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT, SOLR=solr) return try: import settings # Assumed to be in the same directory. except ImportError: 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__ ) sys.exit(1) execute_manager(settings)
def main(set_apps_path=True): if set_apps_path: # Add local apps path. apps_path = os.path.split(os.path.abspath(__file__))[0] if apps_path not in sys.path: sys.path.append(apps_path) if len(sys.argv) >= 2: options = sys.argv[2:] init_options = {} if '--skip-cloudmade-key' in options: init_options = {'skip_cloudmade_key': True,} else: init_options = {'skip_cloudmade_key': False,} if sys.argv[1] == 'setup_all': # We have to special-case this commands, it happens before the # install's localsettings.py is installed, so the usual django # management machinery will throw errors about settings not # being set yet. But after we have run the setup commands we # let it fall through to the normal django method. if not os.path.exists(os.path.join(DATA_ROOT, 'conf')): init_data_dir.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) init_db.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) init_settings.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT, **init_options) else: print "Existing localwiki data directory found! Using %s\n" % DATA_ROOT if len(sys.argv) >= 2: if sys.argv[1] == 'init_data_dir': init_data_dir.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) return if sys.argv[1] == 'init_db': init_db.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) return if sys.argv[1] == 'init_settings': init_settings.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT, **init_options) return os.environ.setdefault("DJANGO_SETTINGS_MODULE", "main.settings") execute_from_command_line(sys.argv)
def main(set_apps_path=True): if set_apps_path: # Add local apps path. apps_path = os.path.split(os.path.abspath(__file__))[0] if apps_path not in sys.path: sys.path.append(apps_path) if len(sys.argv) >= 2 and sys.argv[1] == 'setup_all': # We have to special-case this commands, it happens before the # install's localsettings.py is installed, so the usual django # management machinery will throw errors about settings not # being set yet. But after we have run the setup commands we # let it fall through to the normal django method. if not os.path.exists(os.path.join(DATA_ROOT, 'conf')): init_data_dir.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) init_db.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) init_settings.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) else: print "Existing localwiki data directory found! Using %s\n" % DATA_ROOT if len(sys.argv) >= 2: if sys.argv[1] == 'init_data_dir': init_data_dir.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) return if sys.argv[1] == 'init_db': init_db.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) return if sys.argv[1] == 'init_settings': init_settings.run(DATA_ROOT=DATA_ROOT, PROJECT_ROOT=PROJECT_ROOT) return try: import settings # Assumed to be in the same directory. except ImportError: 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__) sys.exit(1) execute_manager(settings)