|
1 | 1 | import os
|
2 |
| -import site |
3 | 2 |
|
4 | 3 | loc = os.getcwd()
|
5 | 4 | new_loc = loc.replace("\\", "/")
|
6 |
| -venv_templates_path = f"{new_loc}/.venv/Lib/site-packages/Templates" |
7 |
| -# Get the global site-packages directory |
8 |
| -site_packages_path = site.getsitepackages()[0] |
9 |
| -global_templates_path = f"{site_packages_path}/Templates" |
10 | 5 |
|
11 | 6 |
|
12 | 7 | def get_configs(filename):
|
13 |
| - if os.path.exists(venv_templates_path): |
14 |
| - template_folder = venv_templates_path |
15 |
| - elif os.path.exists(global_templates_path): |
16 |
| - template_folder = global_templates_path |
17 |
| - else: |
18 |
| - return "Error: Templates folder not found" |
19 |
| - |
20 |
| - with open(f"{template_folder}/Web/configs/HTML/{filename}", "r", encoding="utf-8") as file: |
| 8 | + with open(f"{new_loc}/Dev/Templates/Web/configs/HTML/{filename}", "r", encoding="utf-8") as file: |
21 | 9 | html_content = file.read()
|
22 | 10 | return html_content
|
23 | 11 |
|
24 | 12 |
|
25 | 13 | def fetch_configs():
|
26 |
| - if os.path.exists(venv_templates_path): |
27 |
| - template_folder = venv_templates_path |
28 |
| - elif os.path.exists(global_templates_path): |
29 |
| - template_folder = global_templates_path |
30 |
| - else: |
31 |
| - return "Error: Templates folder not found" |
32 |
| - |
33 |
| - return os.listdir(f"{template_folder}/configs/HTML/") |
| 14 | + return os.listdir(f"{new_loc}/Dev/Templates/configs/HTML/") |
34 | 15 |
|
35 | 16 |
|
36 | 17 | def setup_configs():
|
37 | 18 | flask_app = """
|
38 | 19 | from flask import Flask, render_template
|
39 |
| -import Templates.setup_templates as ds |
| 20 | +import Dev.Templates.setup_templates as ds |
40 | 21 | import os
|
41 | 22 |
|
42 | 23 | app = Flask(__name__)
|
|
0 commit comments