Dashboard Temp Share Shortlinks Frames API

HTMLify

setup.py
Views: 509 | Author: abh
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from os import system
from  sys import version_info as ver
ver = ver.major
from random import randint
try:
    from app import app, db
    with app.app_context():
        db.create_all()
    i = input("all things set, run the app with \"flask run\", \"python app.py\" or python3 run press enter to exit , r for run the app")
    if i == "r":
        system("flask run")
except:
    print("installing required packages")
    if ver < 3:
        system("pip install -r requirements.txt")
    else:
        system("pip3 install -r requirements.txt")
    print("packags installed\nmaking required directories")
    system("mkdir media")
    system("mkdir media/dp")
    print("genrating a secue key..")
    key = ""
    for _ in range(256):
        key += "qwertyuiopasdfghjklzxcvbnm,.';[]\\\"?><1234567890-=+_)(*&^%$#@!~`"[randint(0, 64)]
    open("config.py", 'w').write("SECRET_KEY=\""+ key +"\"")
    print("key genrated")
    if ver == 3:
        system("python3 setup.py")
    else:
        system("python3 setup.py")