Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Initialize models and compile SQLAlchemy object list
- app_models_file_path = self_path / pathlib.Path('%s/models.py' % app_name)
- app_models_dir_path = self_path / pathlib.Path('%s/models' % app_name)
- app_model_modules = []
- if app_models_file_path.is_file():
- model_module = importlib.import_module('.%s.models' % app_name, 'apps')
- app_model_modules = [model_module]
- elif app_models_dir_path.is_dir():
- app_model_modules = tools.general.get_modules_in_dir(str(app_models_dir_path))
- for module in app_model_modules:
- if hasattr(module, 'db'):
- db_objs.append(module.db)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement