-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdjango_made_easy.py
41 lines (29 loc) · 980 Bytes
/
django_made_easy.py
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
31
32
33
34
35
36
37
38
39
40
41
# Django Made Easy
# https://github.com/hamdivazim/Django-Made-Easy
#
#
# Copyright Hamd Waseem 2023
# This project is licensed under the Apache License 2.0
#
import sys, os
def pip_cmd(cmd):
os.system(Rf"virt\Scripts\pip.exe {cmd} > django-made-easy.log")
def get_args():
return sys.argv[1:]
def set_py_name():
global PYTHON_NAME
if os.system("python --version > django-made-easy.log") != "0":
PYTHON_NAME = "py"
PYTHON_NAME = "python"
def win():
set_py_name()
print("Creating virtual environment...")
os.system(f"{PYTHON_NAME} -m venv virt > django-made-easy.log")
print("Installing django..")
pip_cmd("install django")
print(f"Creating project named {get_args()[0]} at {os.getcwd()} ...")
os.system(Rf"virt\Scripts\django-admin.exe startproject {get_args()[0]} > django-made-easy.log")
os.system("color 07")
print("Remember to activate the virtual enironment 'virt'.")
if __name__ == "__main__":
win()