django-rahavard 0.0.1__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.
- django-rahavard-0.0.1/LICENSE +21 -0
- django-rahavard-0.0.1/PKG-INFO +38 -0
- django-rahavard-0.0.1/README.rst +15 -0
- django-rahavard-0.0.1/django_rahavard/__init__.py +0 -0
- django-rahavard-0.0.1/django_rahavard/apps.py +7 -0
- django-rahavard-0.0.1/django_rahavard/management/__init__.py +0 -0
- django-rahavard-0.0.1/django_rahavard/management/commands/__init__.py +0 -0
- django-rahavard-0.0.1/django_rahavard/management/commands/check_deploy.py +20 -0
- django-rahavard-0.0.1/django_rahavard/management/commands/collectstatic.py +56 -0
- django-rahavard-0.0.1/django_rahavard/management/commands/dumpdata.py +71 -0
- django-rahavard-0.0.1/django_rahavard/migrations/__init__.py +0 -0
- django-rahavard-0.0.1/django_rahavard.egg-info/PKG-INFO +38 -0
- django-rahavard-0.0.1/django_rahavard.egg-info/SOURCES.txt +17 -0
- django-rahavard-0.0.1/django_rahavard.egg-info/dependency_links.txt +1 -0
- django-rahavard-0.0.1/django_rahavard.egg-info/top_level.txt +1 -0
- django-rahavard-0.0.1/pyproject.toml +3 -0
- django-rahavard-0.0.1/setup.cfg +32 -0
- django-rahavard-0.0.1/setup.py +3 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Davoud Arsalani
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: django-rahavard
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A Django App Containing Overridden Django Commands.
|
|
5
|
+
Author: Davoud Arsalani
|
|
6
|
+
Author-email: d_arsalani@yahoo.com
|
|
7
|
+
License: MIT License
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Framework :: Django
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Topic :: Utilities
|
|
14
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
15
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
16
|
+
Classifier: Operating System :: Unix
|
|
17
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
18
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
+
Classifier: Environment :: Web Environment
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
|
|
24
|
+
============
|
|
25
|
+
django-rahavard
|
|
26
|
+
============
|
|
27
|
+
|
|
28
|
+
A Django App Containing Overridden Django Commands.
|
|
29
|
+
|
|
30
|
+
Quick start
|
|
31
|
+
-----------
|
|
32
|
+
|
|
33
|
+
Add "django_rahavard" to your INSTALLED_APPS setting like this:
|
|
34
|
+
|
|
35
|
+
INSTALLED_APPS = [
|
|
36
|
+
...,
|
|
37
|
+
"django_rahavard",
|
|
38
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
============
|
|
2
|
+
django-rahavard
|
|
3
|
+
============
|
|
4
|
+
|
|
5
|
+
A Django App Containing Overridden Django Commands.
|
|
6
|
+
|
|
7
|
+
Quick start
|
|
8
|
+
-----------
|
|
9
|
+
|
|
10
|
+
Add "django_rahavard" to your INSTALLED_APPS setting like this:
|
|
11
|
+
|
|
12
|
+
INSTALLED_APPS = [
|
|
13
|
+
...,
|
|
14
|
+
"django_rahavard",
|
|
15
|
+
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from django.core.management.commands import check
|
|
2
|
+
# from django.core.management.base import CommandError
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## https://stackoverflow.com/a/37755287/14388247
|
|
6
|
+
class Command(check.Command):
|
|
7
|
+
help = 'My Customized Version of the Original check Command'
|
|
8
|
+
|
|
9
|
+
## https://stackoverflow.com/a/78204755/14388247
|
|
10
|
+
def __init__(self, *args, **kwargs):
|
|
11
|
+
kwargs['no_color'] = not kwargs.get('force_color', False)
|
|
12
|
+
super().__init__(*args, **kwargs)
|
|
13
|
+
|
|
14
|
+
def handle(self, *args, **options):
|
|
15
|
+
print('>>> Running customized check')
|
|
16
|
+
|
|
17
|
+
options['deploy'] = True
|
|
18
|
+
options['verbosity'] = 3
|
|
19
|
+
|
|
20
|
+
super().handle(*args, **options)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from django.conf import settings
|
|
2
|
+
from django.contrib.staticfiles.management.commands import collectstatic
|
|
3
|
+
# from django.core.management.base import CommandError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## https://stackoverflow.com/a/37755287/14388247
|
|
7
|
+
class Command(collectstatic.Command):
|
|
8
|
+
help = 'My Customized Version of the Original collectstatic Command'
|
|
9
|
+
|
|
10
|
+
## https://stackoverflow.com/a/78204755/14388247
|
|
11
|
+
def __init__(self, *args, **kwargs):
|
|
12
|
+
kwargs['no_color'] = not kwargs.get('force_color', False)
|
|
13
|
+
super().__init__(*args, **kwargs)
|
|
14
|
+
|
|
15
|
+
def handle(self, *args, **options):
|
|
16
|
+
print('>>> Running customized collectstatic\n')
|
|
17
|
+
|
|
18
|
+
## on remote, static and staticfiles directories are constantly changing
|
|
19
|
+
## so there may be important files present in staticfiles directory
|
|
20
|
+
## but absent in static directory
|
|
21
|
+
## for example 'uploads' or 'dl' directory
|
|
22
|
+
## so let's clear staticfiles only when we are on local machine
|
|
23
|
+
## and everything is safe
|
|
24
|
+
if settings.DEBUG:
|
|
25
|
+
options['clear'] = True
|
|
26
|
+
|
|
27
|
+
options['interactive'] = False
|
|
28
|
+
options['ignore_patterns'] = [
|
|
29
|
+
'dl/*',
|
|
30
|
+
]
|
|
31
|
+
options['verbosity'] = 3
|
|
32
|
+
|
|
33
|
+
super().handle(*args, **options)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
###############################
|
|
37
|
+
|
|
38
|
+
## method 2
|
|
39
|
+
## the disadvantage with this method is I couldn't find a way to pass args.
|
|
40
|
+
## e.g. the command 'manage.py collectstatic --dry-run wont work'
|
|
41
|
+
|
|
42
|
+
# from django.core.management import call_command
|
|
43
|
+
# from django.core.management.base import BaseCommand, CommandError
|
|
44
|
+
|
|
45
|
+
## https://stackoverflow.com/a/75189544/14388247
|
|
46
|
+
# class Command(BaseCommand):
|
|
47
|
+
# help = 'My Customized Version of the Original collectstatic Command'
|
|
48
|
+
|
|
49
|
+
# def handle(self, *args, **kwargs):
|
|
50
|
+
# call_command(
|
|
51
|
+
# 'collectstatic',
|
|
52
|
+
# ignore_patterns=['dl/*'],
|
|
53
|
+
# clear=True,
|
|
54
|
+
# interactive=False,
|
|
55
|
+
# **kwargs,
|
|
56
|
+
# )
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
from django.conf import settings
|
|
2
|
+
from django.core.management.commands import dumpdata
|
|
3
|
+
# from django.core.management.base import CommandError
|
|
4
|
+
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from os import path, makedirs, remove
|
|
7
|
+
from time import sleep
|
|
8
|
+
|
|
9
|
+
from rahavard import (
|
|
10
|
+
get_list_of_files,
|
|
11
|
+
to_tilda,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## https://stackoverflow.com/a/37755287/14388247
|
|
16
|
+
class Command(dumpdata.Command):
|
|
17
|
+
help = 'My Customized Version of the Original dumpdata Command'
|
|
18
|
+
|
|
19
|
+
## https://stackoverflow.com/a/78204755/14388247
|
|
20
|
+
def __init__(self, *args, **kwargs):
|
|
21
|
+
kwargs['no_color'] = not kwargs.get('force_color', False)
|
|
22
|
+
super().__init__(*args, **kwargs)
|
|
23
|
+
|
|
24
|
+
def handle(self, *args, **options):
|
|
25
|
+
|
|
26
|
+
## dump --------------
|
|
27
|
+
|
|
28
|
+
print('>>> Running customized dumpdata\n')
|
|
29
|
+
|
|
30
|
+
dest_dir = f'{settings.PROJECT_DIR}/dumped'
|
|
31
|
+
if not path.exists(dest_dir):
|
|
32
|
+
print(f'creating {dest_dir}')
|
|
33
|
+
makedirs(dest_dir)
|
|
34
|
+
|
|
35
|
+
ymdhms = datetime.now().strftime('%Y-%m-%d-%H-%M-%S')
|
|
36
|
+
extension = 'json'
|
|
37
|
+
|
|
38
|
+
output_file = f'{dest_dir}/{settings.HOST_NAME}-{ymdhms}.{extension}'
|
|
39
|
+
print(f'dumping to: {to_tilda(output_file)}')
|
|
40
|
+
|
|
41
|
+
## commented because caused errors
|
|
42
|
+
# -e contenttypes -e auth.Permission
|
|
43
|
+
|
|
44
|
+
options['format'] = extension
|
|
45
|
+
options['indent'] = 2
|
|
46
|
+
options['skip_checks'] = True
|
|
47
|
+
options['output'] = output_file
|
|
48
|
+
options['use_natural_foreign_keys'] = True
|
|
49
|
+
options['use_natural_primary_keys'] = True
|
|
50
|
+
options['verbosity'] = 3
|
|
51
|
+
# --all
|
|
52
|
+
|
|
53
|
+
super().handle(*args, **options)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## rotate --------------
|
|
57
|
+
|
|
58
|
+
print('getting list of already dumped files')
|
|
59
|
+
dumped_files = get_list_of_files(directory=dest_dir, extension=extension)
|
|
60
|
+
print(f' count: {len(dumped_files)}')
|
|
61
|
+
|
|
62
|
+
LAST_DUMPED_FILES_TO_SKIP = 240 ## last n dumped_files to skip removing
|
|
63
|
+
to_be_removed = dumped_files[:-LAST_DUMPED_FILES_TO_SKIP]
|
|
64
|
+
|
|
65
|
+
if to_be_removed:
|
|
66
|
+
to_be_removed__len = len(to_be_removed)
|
|
67
|
+
print(f'{to_be_removed__len} to be removed:')
|
|
68
|
+
for idx, tbr in enumerate(to_be_removed, start=1):
|
|
69
|
+
print(f' {idx}/{to_be_removed__len}: removing {tbr}')
|
|
70
|
+
remove(tbr)
|
|
71
|
+
sleep(.1)
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: django-rahavard
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A Django App Containing Overridden Django Commands.
|
|
5
|
+
Author: Davoud Arsalani
|
|
6
|
+
Author-email: d_arsalani@yahoo.com
|
|
7
|
+
License: MIT License
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Framework :: Django
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Topic :: Utilities
|
|
14
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
15
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
16
|
+
Classifier: Operating System :: Unix
|
|
17
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
18
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
+
Classifier: Environment :: Web Environment
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
|
|
24
|
+
============
|
|
25
|
+
django-rahavard
|
|
26
|
+
============
|
|
27
|
+
|
|
28
|
+
A Django App Containing Overridden Django Commands.
|
|
29
|
+
|
|
30
|
+
Quick start
|
|
31
|
+
-----------
|
|
32
|
+
|
|
33
|
+
Add "django_rahavard" to your INSTALLED_APPS setting like this:
|
|
34
|
+
|
|
35
|
+
INSTALLED_APPS = [
|
|
36
|
+
...,
|
|
37
|
+
"django_rahavard",
|
|
38
|
+
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.rst
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.cfg
|
|
5
|
+
setup.py
|
|
6
|
+
django_rahavard/__init__.py
|
|
7
|
+
django_rahavard/apps.py
|
|
8
|
+
django_rahavard.egg-info/PKG-INFO
|
|
9
|
+
django_rahavard.egg-info/SOURCES.txt
|
|
10
|
+
django_rahavard.egg-info/dependency_links.txt
|
|
11
|
+
django_rahavard.egg-info/top_level.txt
|
|
12
|
+
django_rahavard/management/__init__.py
|
|
13
|
+
django_rahavard/management/commands/__init__.py
|
|
14
|
+
django_rahavard/management/commands/check_deploy.py
|
|
15
|
+
django_rahavard/management/commands/collectstatic.py
|
|
16
|
+
django_rahavard/management/commands/dumpdata.py
|
|
17
|
+
django_rahavard/migrations/__init__.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
django_rahavard
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
name = django-rahavard
|
|
3
|
+
version = 0.0.1
|
|
4
|
+
description = A Django App Containing Overridden Django Commands.
|
|
5
|
+
long_description = file: README.rst
|
|
6
|
+
long_description_content_type = text/markdown
|
|
7
|
+
author = Davoud Arsalani
|
|
8
|
+
author_email = d_arsalani@yahoo.com
|
|
9
|
+
license = MIT License
|
|
10
|
+
classifiers =
|
|
11
|
+
Development Status :: 4 - Beta
|
|
12
|
+
Intended Audience :: Developers
|
|
13
|
+
Programming Language :: Python :: 3
|
|
14
|
+
Framework :: Django
|
|
15
|
+
License :: OSI Approved :: MIT License
|
|
16
|
+
Topic :: Utilities
|
|
17
|
+
Topic :: Internet :: WWW/HTTP
|
|
18
|
+
Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
19
|
+
Operating System :: Unix
|
|
20
|
+
Operating System :: MacOS :: MacOS X
|
|
21
|
+
Operating System :: Microsoft :: Windows
|
|
22
|
+
Environment :: Web Environment
|
|
23
|
+
|
|
24
|
+
[options]
|
|
25
|
+
include_package_data = true
|
|
26
|
+
packages = find:
|
|
27
|
+
python_requires = >=3.10
|
|
28
|
+
|
|
29
|
+
[egg_info]
|
|
30
|
+
tag_build =
|
|
31
|
+
tag_date = 0
|
|
32
|
+
|