当前位置:网站首页>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
边栏推荐
- Some common functions and precautions
- Ubuntu20.04 PostgreSQL 14 installation configuration record
- [punch in - Blue Bridge Cup] day 1 --% 7F format output
- [wechat applet] how did the conditional rendering list render work?
- 第2章 控制结构和函数(编程题)
- Is the largest layoff and salary cut on the internet coming?
- Global and Chinese markets for active transdermal drug delivery devices 2022-2028: Research Report on technology, participants, trends, market size and share
- 云原生——Web实时通信技术之Websocket
- Integrating viewbinding and viewholder with reflection
- [0x0] 校长留的开放问题作业
猜你喜欢

Tidb 6.0: making Tso more efficient tidb Book rush

Arrangement of language resources of upgraded version

On the optimization and use of idea

Is the largest layoff and salary cut on the internet coming?

华为云原生——数据开发与DataFactory

December2020 - true questions and analysis of C language (Level 2) in the youth level examination of the Electronic Society

Learning cyclic redundancy CRC check
![[qt] qmap usage details](/img/ee/6e71a3dc5b90d2d1b7f7d3f6b56221.png)
[qt] qmap usage details

How do college students make money by programming| My way to make money in College

Redis high concurrency distributed locks (learning summary)
随机推荐
Stc89c52/90c516rd/89c516rd DHT11 temperature and humidity sensor drive code
Global and Chinese market for nasal drug delivery devices 2022-2028: Research Report on technology, participants, trends, market size and share
Huawei interview question: divide candy
Openssl3.0 learning 22 provider decoder
【力扣刷题总结】数据库题目按知识点分类总结(持续更新/简单和中等题已完结)
利用反射整合ViewBinding和ViewHolder
C#【高级篇】 C# 匿名方法【待补充Lambda表达式。。。】
A minimalist way to integrate databinding into activity/fragment
Product thinking - is the future of UAV express worth looking forward to?
实用调试技巧
.NET 7 的 JWT 配置太方便了!
Redis在windows系统中使用
Some common functions and precautions
Realization of BFS in C language by storing adjacency matrix of graph
From 2500 a month, no one wants to go to the programming road of the technical director of a large factory | my ten years
dbt产品初体验
LitJson解析 生成json文件 读取json文件中的字典
【常见问题】浏览器环境、node环境的模块化问题
[0x0] 校长留的开放问题作业
1151_ Makefile learning_ Static matching pattern rules in makefile