def handle(self, *args, **options): app_name = args[0] module = importlib.import_module(app_name) path = os.path.dirname(module.__file__) + os.sep project_path = os.path.dirname(os.path.normpath(os.sys.modules[settings.SETTINGS_MODULE].__file__)) install_app('social_auth') copy_tree(os.path.dirname(djangobp.__file__) + os.sep + 'scaffold/socialauth/templates/accounts', path + '/templates/accounts', update=True) copy_file(os.path.dirname(djangobp.__file__) + os.sep + 'scaffold/socialauth/controllers/accounts.py', path + '/controllers', update=True) copy_file(os.path.dirname(djangobp.__file__) + os.sep + 'scaffold/scaffold/socialauthsettings.py', project_path, update=True) urls_edit = CodeEditor(path + 'urls.py') urls_edit.insert_line("url(r'', include('social_auth.urls')),", 'urlpatterns') urls_edit.commit() settings_edit = CodeEditor(project_path + os.sep + 'settings.py') settings_edit.append_line("from socialauthsettings import *") settings_edit.commit() # TODO copy controllers/accounts.py # TODO copy templates/accounts/login.html # TODO urls social auth # TODO django-social-auth settings
def handle(self, *args, **options): install_app(args[0])
#!/usr/bin/env python from djangobp.editsettings import install_app import sys import os import importlib if __name__ == "__main__": settings = os.getcwd().split('/')[-1] + '.settings' sys.path.append('.') os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings) install_app('djangobp')