当前位置:网站首页>Solutions for project paths
Solutions for project paths
2022-06-30 03:41:00 【smallfish118】
Relative paths
Project migration , This path will not be available , When I was outsourcing from Huawei , The code provided by Huawei , There are all the relative paths of the configuration . So the environment deployment tutorial provided by Huawei , It is also clearly stated that , Under which path does the project need to be configured .
ps: I am 19 Method used in
Absolute path
It can reduce the cost of migration , No matter which path the project moves to , Configure the absolute path of the project by yourself , It can also operate normally . But here's the problem , Every time a project is migrated, the configuration needs to be modified
ps: I am 20 Method used in
pathlib
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parentAbove is django The configuration solution of the built-in project path , We need a little remoulding , Because when we use paths , Is to use str, So do the conversion . Of course , You also have to configure the path according to the actual situation , decision parent The number of
from pathlib import Path
# The absolute path of the project
PROJECT_PATH = str(Path(__file__).resolve().parent.parent)ps: My current method
边栏推荐
- 共124篇!墨天轮“高可用架构”干货文档分享(含Oracle、MySQL、PG)
- unity input system 使用记录(实例版)
- dbt产品初体验
- [summary of skimming questions] database questions are summarized by knowledge points (continuous update / simple and medium questions have been completed)
- QT中foreach的使用
- 第2章 控制结构和函数(编程题)
- Principle of device driver
- [operation] getting started with MySQL on May 23, 2022
- 【筆記】AB測試和方差分析
- 【笔记】2022.6.7 数据分析概论
猜你喜欢

51单片机的室内环境监测系统,MQ-2烟雾传感器和DHT11温湿度传感器,原理图,C编程和仿真

关于智能视觉组上的机械臂

实用调试技巧

How to view Tencent's 2022 school recruitment salary, the total contract of cabbage is 40W?

Number of students from junior college to Senior College (III)

1148_ Makefile learning_ Targets, variables, and wildcards in makefile

unity input system 使用记录(实例版)

dbt产品初体验

UML图与List集合

【力扣刷题总结】数据库题目按知识点分类总结(持续更新/简单和中等题已完结)
随机推荐
Realization of BFS in C language by storing adjacency matrix of graph
C#【高级篇】 C# 多线程
【作业】2022.5.28 将CSV写入数据库
Huawei interview question: tall and short people queue up
[Note] ab Test and Variance Analysis
专升本高数(三)
Hisense A7 ink screen mobile phone cannot be started
Note: load the configuration file as a byte stream and get the resources in it
What does the hyphen mean for a block in Twig like in {% block body -%}?
C#【高级篇】 C# 匿名方法【待补充Lambda表达式。。。】
Integrating viewbinding and viewholder with reflection
Global and Chinese markets for advanced wound care 2022-2028: Research Report on technology, participants, trends, market size and share
C#【高级篇】 C# 接口(Interface)
Chapter 2 control structure and function (programming problem)
EasyCVR部署服务器集群时,出现一台在线一台不在线是什么原因?
【力扣刷题总结】数据库题目按知识点分类总结(持续更新/简单和中等题已完结)
绿色新动力,算力“零”负担——JASMINER X4系列火爆热销中
【笔记】2022.6.7 数据分析概论
[frequently asked questions] modularization of browser environment and node environment
MySQL performance optimization (6): read write separation