ilds 2.2.2__tar.gz → 2.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {ilds-2.2.2 → ilds-2.2.3}/PKG-INFO +1 -1
  2. {ilds-2.2.2 → ilds-2.2.3}/ilds/django/util.py +15 -8
  3. {ilds-2.2.2 → ilds-2.2.3}/ilds/versions.py +1 -1
  4. {ilds-2.2.2 → ilds-2.2.3}/ilds.egg-info/PKG-INFO +1 -1
  5. {ilds-2.2.2 → ilds-2.2.3}/README.rst +0 -0
  6. {ilds-2.2.2 → ilds-2.2.3}/ilds/__init__.py +0 -0
  7. {ilds-2.2.2 → ilds-2.2.3}/ilds/cmd.py +0 -0
  8. {ilds-2.2.2 → ilds-2.2.3}/ilds/django/__init__.py +0 -0
  9. {ilds-2.2.2 → ilds-2.2.3}/ilds/django/admin.py +0 -0
  10. {ilds-2.2.2 → ilds-2.2.3}/ilds/django/import_export.py +0 -0
  11. {ilds-2.2.2 → ilds-2.2.3}/ilds/django/model.py +0 -0
  12. {ilds-2.2.2 → ilds-2.2.3}/ilds/django/user.py +0 -0
  13. {ilds-2.2.2 → ilds-2.2.3}/ilds/everything.py +0 -0
  14. {ilds-2.2.2 → ilds-2.2.3}/ilds/excel_xlrd.py +0 -0
  15. {ilds-2.2.2 → ilds-2.2.3}/ilds/excel_xlsx.py +0 -0
  16. {ilds-2.2.2 → ilds-2.2.3}/ilds/file.py +0 -0
  17. {ilds-2.2.2 → ilds-2.2.3}/ilds/lib/__init__.py +0 -0
  18. {ilds-2.2.2 → ilds-2.2.3}/ilds/lib/browsercookie.py +0 -0
  19. {ilds-2.2.2 → ilds-2.2.3}/ilds/lib/configobj/__init__.py +0 -0
  20. {ilds-2.2.2 → ilds-2.2.3}/ilds/lib/configobj/_version.py +0 -0
  21. {ilds-2.2.2 → ilds-2.2.3}/ilds/lib/configobj/validate.py +0 -0
  22. {ilds-2.2.2 → ilds-2.2.3}/ilds/lib/hexdump.py +0 -0
  23. {ilds-2.2.2 → ilds-2.2.3}/ilds/match_data.py +0 -0
  24. {ilds-2.2.2 → ilds-2.2.3}/ilds/md.py +0 -0
  25. {ilds-2.2.2 → ilds-2.2.3}/ilds/md5summer.py +0 -0
  26. {ilds-2.2.2 → ilds-2.2.3}/ilds/mycsv.py +0 -0
  27. {ilds-2.2.2 → ilds-2.2.3}/ilds/net.py +0 -0
  28. {ilds-2.2.2 → ilds-2.2.3}/ilds/pd.py +0 -0
  29. {ilds-2.2.2 → ilds-2.2.3}/ilds/spider.py +0 -0
  30. {ilds-2.2.2 → ilds-2.2.3}/ilds/time.py +0 -0
  31. {ilds-2.2.2 → ilds-2.2.3}/ilds/util.py +0 -0
  32. {ilds-2.2.2 → ilds-2.2.3}/ilds.egg-info/SOURCES.txt +0 -0
  33. {ilds-2.2.2 → ilds-2.2.3}/ilds.egg-info/dependency_links.txt +0 -0
  34. {ilds-2.2.2 → ilds-2.2.3}/ilds.egg-info/requires.txt +0 -0
  35. {ilds-2.2.2 → ilds-2.2.3}/ilds.egg-info/top_level.txt +0 -0
  36. {ilds-2.2.2 → ilds-2.2.3}/setup.cfg +0 -0
  37. {ilds-2.2.2 → ilds-2.2.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: ilds
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: 常用模块的集合,为了多平台,多电脑调用方便!
5
5
  Home-page: https://github.com/ldsxp/ilds
6
6
  Author: lds
@@ -2,9 +2,9 @@
2
2
  #
3
3
  # ---------------------------------------
4
4
  # 程序:util.py
5
- # 版本:0.3
5
+ # 版本:0.4
6
6
  # 作者:lds
7
- # 日期:2019-01-21
7
+ # 日期:2024-09-18
8
8
  # 语言:Python 3.X
9
9
  # 说明:常用的函数集合
10
10
  # ---------------------------------------
@@ -20,23 +20,30 @@ def django_setup(project_name=None, site_path=None):
20
20
  """
21
21
  设置 Django 运行环境
22
22
 
23
+ 用法示例:
23
24
  from ilds.django.util import django_setup
24
25
  django_setup(r'mysite', site_path=None)
25
26
  """
26
27
 
27
- if site_path is not None:
28
+ if site_path:
28
29
  sys.path.insert(0, site_path)
29
30
 
30
- if project_name is None:
31
- project_name = os.path.split(os.path.dirname(__file__))[-1]
32
- print('项目:', project_name)
33
- os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{}.settings".format(project_name))
31
+ if not project_name:
32
+ project_name = os.path.basename(os.path.dirname(__file__))
33
+
34
+ print(f'项目:{project_name}')
35
+
36
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", f"{project_name}.settings")
37
+
34
38
  try:
35
39
  import django
36
40
  django.setup()
37
41
  except ModuleNotFoundError as e:
38
42
  print("注:如果找不到 Django,请安装它: pip install django\n错误提示:", e)
39
- exit()
43
+ exit(1) # 使用非零退出代码表示程序异常退出
44
+ except Exception as e:
45
+ print("发生了意外错误:", e)
46
+ exit(1)
40
47
 
41
48
 
42
49
  def random_key():
@@ -1,4 +1,4 @@
1
- version = '2.2.2'
1
+ version = '2.2.3'
2
2
 
3
3
  # 因为日期格式问题,所以下面的版本号不能使用
4
4
  # 主版本号 (Major Version): 较大的功能变化或结构调整
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: ilds
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: 常用模块的集合,为了多平台,多电脑调用方便!
5
5
  Home-page: https://github.com/ldsxp/ilds
6
6
  Author: lds
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes