File size: 1,315 Bytes
dacf14a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42
43
44
45
46
47
48
49
50
51
52
53
import os
from pathlib import Path
import logging

logging.basicConfig(
    level=logging.INFO,
    format='[%(asctime)s]: %(message)s',
)

project_name = 'my_project'

list_of_files = [
    # Backend
    f"backend/app/__init__.py",
    f"backend/app/main.py",
    f"backend/app/models.py",
    f"backend/app/schemas.py",
    f"backend/app/api/__init__.py",
    f"backend/app/api/v1/__init__.py",
    f"backend/app/api/v1/qa.py",
    f"backend/app/api/v1/config.py",
    f"backend/tests/__init__.py",
    f"backend/tests/test_qa.py",
    f"backend/tests/test_config.py",
    f"backend/Dockerfile",
    f"backend/requirements.txt",
    f"backend/README.md",
    
    # Frontend
    f"frontend/app.py",
    f"frontend/Dockerfile",
    f"frontend/requirements.txt",
    f"frontend/README.md",

    # Root
    ".gitignore",
    "README.md"
]

for path in list_of_files:
    file_path = Path(path)
    filedir, filename = os.path.split(file_path)

    if filedir != "":
        os.makedirs(filedir, exist_ok=True)
        logging.info(f"Created directory {filedir}")
    if (not os.path.exists(file_path)) or (os.path.getsize(file_path) == 0):
        with open(file_path, "w") as f:
            pass
            logging.info(f"Created file {filename}")
    else:
        logging.info(f"File {filename} already exists")