django-vue-admin/backend/dev/_venv.py

20 lines
617 B
Python
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import os
import sys
from pathlib import Path
# #################### start #######################
# AREPL for python调试导入项目依赖 (可禁用)
BASE_DIR = Path(__file__).parent.parent
VENV_DIR = Path.joinpath(BASE_DIR, "__pypackages__", "3.8", "lib") # PDM
# print(f"{BASE_DIR=}")
# 确认BASE_DIR无误后添加如下路径至系统路径
for dir in [str(BASE_DIR), str(VENV_DIR)]:
if dir not in sys.path:
sys.path.insert(1, dir)
# #################### end #########################
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "application.settings")
django.setup()