Пример #1
0
    def migrate(self, mig):
        if mig:
            pull.print("*",
                       "Migration Phase. Initializing File & Configurations.",
                       pull.YELLOW)

            config = CONFIG()
            config.read_variables()
            config.generate_key()
            config.write()

            time.sleep(3)
            application = GETWSGI()

            pull.print("^", "Configuration Done. Uprnning Migrations Now. ",
                       pull.DARKCYAN)
            DJANGOCALL('makemigrations',
                       stdout=(sys.stdout if self.debug else self.npointer))
            pull.verbose("*", "Files Modified. Running Into Final Stage. ",
                         self.verbose, pull.YELLOW)
            DJANGOCALL('migrate',
                       stdout=(sys.stdout if self.debug else self.npointer))
            pull.halt("Migrations Applied Successfuly. Exiting Now!", True,
                      pull.GREEN)

            return True
        return False
Пример #2
0
    def configure(self, conf):
        if conf:
            toset = pull.input(
                "-",
                "Do you Want To Configure Your Database Credentials? [Y/n] ",
                ("y", "n"), pull.BLUE)
            if toset:

                dbase = pull.input("?", "Enter Your Database Name: ", False,
                                   pull.GREEN)
                serve = pull.input("?", "Enter Your Server Name [localhost]: ",
                                   False, pull.GREEN)
                uname = pull.input("?", "Enter Database Username: "******"?", "Enter Database Password: "******"^", "Checking Database Connection. Connecting!",
                           pull.DARKCYAN)
                try:
                    pymysql.connect(serve, uname, passw, dbase)
                except pymysql.err.OperationalError:
                    pull.halt(
                        "Access Denied for the user. Check Credentials and Server Status!",
                        True, pull.RED)

                config = CONFIG()
                config.read_variables()
                config.db_create(dbase, serve, uname, passw)
                config.write_variables()

            else:
                pull.print(
                    "*", "Skipped Configuration of Database. Proceeding now. ",
                    pull.YELLOW)

            pull.halt("Done Configurations. Exiting", True, pull.RED)