Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def excute_manage_cmd(self):
with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
os.system("python manage.py " + self._cmd)
def main(self):
with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
try:
os.system("python manage.py runserver")
except KeyboardInterrupt:
mys.log("Good bye!")
except:
mys.log("Failed to launch web browser!", withError = True)
def main(self):
with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
mys.log("Making migrations...")
self._make_migration()
self._apply_migration()
def main(self):
# Beta Warning
mys.log("This feature is now under Beta version.", withError=True)
# Logger instance
logger = mys.progress.Progress()
with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
# In advance checking.
try:
self._check(logger)
except:
return
logger.write("Searching application %s..." % self._app, withLazy = True)
if Path(self._app).is_dir():
mys.log(os.getcwd())
shutil.copytree(self._app, os.path.join(self._to, self._app))
logger.update("Completed!")
else:
logger.update("Can not detect application %s!" % self._app)
mys.log("Failed to transfer app %s!" % self._app, withError = True,
def _create_app(self, name):
with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
mys.command("python manage.py startapp " + name)
def _merge(self):
with proj.MirageEnvironment(proj.MirageEnvironmentLevel.inapp):
mys.log("Integrate migrations...")
with proj.InDir("migrations"):
path_obj = Path(os.getcwd())
migration_script_path = path_obj.glob("*.py")
for path in migration_script_path:
if not "__init__.py" in str(path):
mys.log("Removing " + str(path) + "!")
os.remove(path)
with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
os.system("python manage.py makemigrations")
def _merge(self):
with proj.MirageEnvironment(proj.MirageEnvironmentLevel.inapp):
mys.log("Integrate migrations...")
with proj.InDir("migrations"):
path_obj = Path(os.getcwd())
migration_script_path = path_obj.glob("*.py")
for path in migration_script_path:
if not "__init__.py" in str(path):
mys.log("Removing " + str(path) + "!")
os.remove(path)
with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
os.system("python manage.py makemigrations")
def persist(file_path, domain):
object_id = str(uuid.uuid4())
absolute_path = os.getcwd() + "/" + file_path
# Logger instance
logger = mys.progress.Progress()
with MirageEnvironment(MirageEnvironmentLevel.inproject):
logger.write("Safety caching...", withLazy = True)
fileable.cd(".mirage/cache/")
fileable.copy(absolute_path, os.getcwd() + "/" + file_path, force = True)
logger.update("Archiving files...", withLazy = True)
shutil.make_archive(object_id, "zip", root_dir = absolute_path)
fileable.move(object_id + ".zip", "../persistence/")
MirageWorkspace.__write_persistence_file_meta(object_id, ".mirage/persistence/", domain)
logger.update("Saving file completed!", withLazy = True)
def initialize():
with MirageEnvironment(MirageEnvironmentLevel.inproject):
if not fileable.exists(".mirage"):
mys.log("Creating Mirage workspace...")
fileable.mkdir(".mirage")
fileable.mkdir(".mirage/cache/")
fileable.mkdir(".mirage/persistence/")
def main(self) -> bool:
mys.log("Now under construction.")
return
with MirageEnvironment(MirageEnvironmentLevel.inproject):
try:
instance = self.load_script()
except:
return False
instance.execute(self._cli, self._option)
return True