django-manage-shell 0.1.0__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.
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-manage-shell
3
+ Version: 0.1.0
4
+ Summary: Django manage.py shell
5
+ Requires-Python: >=3.8
6
+ Requires-Dist: django>=4
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-manage-shell
3
+ Version: 0.1.0
4
+ Summary: Django manage.py shell
5
+ Requires-Python: >=3.8
6
+ Requires-Dist: django>=4
@@ -0,0 +1,8 @@
1
+ django_manage_shell.py
2
+ pyproject.toml
3
+ django_manage_shell.egg-info/PKG-INFO
4
+ django_manage_shell.egg-info/SOURCES.txt
5
+ django_manage_shell.egg-info/dependency_links.txt
6
+ django_manage_shell.egg-info/entry_points.txt
7
+ django_manage_shell.egg-info/requires.txt
8
+ django_manage_shell.egg-info/top_level.txt
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ dms = django_manage_shell:main
3
+ dmsh = django_manage_shell:main
@@ -0,0 +1 @@
1
+ django_manage_shell
@@ -0,0 +1,30 @@
1
+ import os, re, sys
2
+
3
+
4
+ def get_project_name_from_manage_py(manage_py_path: str = 'manage.py'):
5
+ with open(manage_py_path, 'r', encoding='utf-8') as f:
6
+ content = f.read()
7
+
8
+ match = re.search(
9
+ r"os\.environ\.setdefault\('DJANGO_SETTINGS_MODULE',\s*'([^']+)'\)",
10
+ content
11
+ )
12
+
13
+ if match:
14
+ settings_module = match.group(1)
15
+ return settings_module.split('.')[0]
16
+
17
+ return None
18
+
19
+
20
+ def main():
21
+ try:
22
+ while True:
23
+ command = input(f'manage.py@{get_project_name_from_manage_py()} > ')
24
+ if command == 'exit':
25
+ sys.exit(0)
26
+ os.system(f'python manage.py {command}')
27
+ except KeyboardInterrupt: pass
28
+
29
+ if __name__ == '__main__':
30
+ main()
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "django-manage-shell"
7
+ version = "0.1.0"
8
+ description = "Django manage.py shell"
9
+ requires-python = ">=3.8"
10
+ dependencies = [
11
+ "django>=4",
12
+ ]
13
+
14
+ [project.scripts]
15
+ dms = 'django_manage_shell:main'
16
+ dmsh = 'django_manage_shell:main'
17
+
18
+ [dependency-groups]
19
+ dev = [
20
+ "build>=1.2.2",
21
+ ]
22
+
23
+ [tool.setuptools]
24
+ py-modules = ["django_manage_shell"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+