quickscale 0.1.0__py3-none-any.whl
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.
- quickscale/__init__.py +11 -0
- quickscale/cli.py +180 -0
- quickscale/scripts/__init__.py +13 -0
- quickscale/scripts/__pycache__/__init__.cpython-312.pyc +0 -0
- quickscale/scripts/__pycache__/scripts.cpython-312.pyc +0 -0
- quickscale/scripts/__pycache__/utils.cpython-312.pyc +0 -0
- quickscale/scripts/scripts.py +486 -0
- quickscale/scripts/utils.py +88 -0
- quickscale/templates/.dockerignore +60 -0
- quickscale/templates/.env +7 -0
- quickscale/templates/Dockerfile +22 -0
- quickscale/templates/common/apps.py +5 -0
- quickscale/templates/common/urls.py +8 -0
- quickscale/templates/common/views.py +4 -0
- quickscale/templates/core/settings.py +102 -0
- quickscale/templates/core/urls.py +12 -0
- quickscale/templates/dashboard/apps.py +5 -0
- quickscale/templates/dashboard/urls.py +8 -0
- quickscale/templates/dashboard/views.py +8 -0
- quickscale/templates/docker-compose.yml +31 -0
- quickscale/templates/public/apps.py +5 -0
- quickscale/templates/public/urls.py +10 -0
- quickscale/templates/public/views.py +23 -0
- quickscale/templates/requirements.txt +5 -0
- quickscale/templates/templates/base/base.html +32 -0
- quickscale/templates/templates/base.html +0 -0
- quickscale/templates/templates/components/footer.html +10 -0
- quickscale/templates/templates/components/messages.html +13 -0
- quickscale/templates/templates/components/navbar.html +67 -0
- quickscale/templates/templates/dashboard/index.html +76 -0
- quickscale/templates/templates/public/about.html +43 -0
- quickscale/templates/templates/public/contact.html +73 -0
- quickscale/templates/templates/public/home.html +0 -0
- quickscale/templates/templates/public/index.html +124 -0
- quickscale/templates/templates/users/login.html +7 -0
- quickscale/templates/templates/users/login_form.html +58 -0
- quickscale/templates/templates/users/profile.html +43 -0
- quickscale/templates/templates/users/signup.html +74 -0
- quickscale/templates/users/apps.py +5 -0
- quickscale/templates/users/urls.py +11 -0
- quickscale/templates/users/views.py +96 -0
- quickscale-0.1.0.dist-info/METADATA +13 -0
- quickscale-0.1.0.dist-info/RECORD +47 -0
- quickscale-0.1.0.dist-info/WHEEL +5 -0
- quickscale-0.1.0.dist-info/entry_points.txt +2 -0
- quickscale-0.1.0.dist-info/licenses/LICENSE +201 -0
- quickscale-0.1.0.dist-info/top_level.txt +1 -0
quickscale/__init__.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# QuickScale - A Django SaaS Starter Kit for Python-First Developers
|
|
2
|
+
|
|
3
|
+
# Single source of truth for package version
|
|
4
|
+
__version__ = "0.1.0"
|
|
5
|
+
|
|
6
|
+
try:
|
|
7
|
+
from importlib.metadata import version
|
|
8
|
+
__version__ = version("quickscale")
|
|
9
|
+
except ImportError:
|
|
10
|
+
# Package is not installed
|
|
11
|
+
pass
|
quickscale/cli.py
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import argparse
|
|
4
|
+
import subprocess
|
|
5
|
+
import textwrap
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from .scripts import (
|
|
8
|
+
build_project,
|
|
9
|
+
up,
|
|
10
|
+
down,
|
|
11
|
+
destroy,
|
|
12
|
+
check,
|
|
13
|
+
clean,
|
|
14
|
+
logs,
|
|
15
|
+
manage,
|
|
16
|
+
update,
|
|
17
|
+
)
|
|
18
|
+
from . import __version__
|
|
19
|
+
|
|
20
|
+
# Display status of running Docker services with error handling
|
|
21
|
+
def ps():
|
|
22
|
+
if not os.path.exists("docker-compose.yml"):
|
|
23
|
+
print("No active project found in the current directory.")
|
|
24
|
+
print("Please navigate to the project directory or use 'quickscale build' to create a new project.")
|
|
25
|
+
return
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
print("Checking service status...")
|
|
29
|
+
subprocess.run(["docker", "compose", "ps"], check=True)
|
|
30
|
+
except subprocess.SubprocessError as e:
|
|
31
|
+
print(f"Error checking service status: {e}")
|
|
32
|
+
sys.exit(1)
|
|
33
|
+
|
|
34
|
+
# Provide help information about Django manage commands
|
|
35
|
+
def manage_help():
|
|
36
|
+
print("QuickScale Django Management Commands")
|
|
37
|
+
print("=====================================")
|
|
38
|
+
print("\nThe 'manage' command allows you to run any Django management command inside your project's Docker container.")
|
|
39
|
+
print("\nCommon commands:\n")
|
|
40
|
+
|
|
41
|
+
commands = [
|
|
42
|
+
("Database:", ""),
|
|
43
|
+
(" migrate", "Apply database migrations"),
|
|
44
|
+
(" makemigrations", "Create new migrations based on model changes"),
|
|
45
|
+
(" sqlmigrate", "Show SQL statements for a migration"),
|
|
46
|
+
("", ""),
|
|
47
|
+
("User Management:", ""),
|
|
48
|
+
(" createsuperuser", "Create a Django admin superuser"),
|
|
49
|
+
(" changepassword", "Change a user's password"),
|
|
50
|
+
("", ""),
|
|
51
|
+
("Testing:", ""),
|
|
52
|
+
(" test", "Run all tests"),
|
|
53
|
+
(" test app_name", "Run tests for a specific app"),
|
|
54
|
+
(" test app.TestClass", "Run tests in a specific test class"),
|
|
55
|
+
("", ""),
|
|
56
|
+
("Application:", ""),
|
|
57
|
+
(" startapp", "Create a new Django app"),
|
|
58
|
+
(" shell", "Open Django interactive shell"),
|
|
59
|
+
(" dbshell", "Open database shell"),
|
|
60
|
+
("", ""),
|
|
61
|
+
("Static Files:", ""),
|
|
62
|
+
(" collectstatic", "Collect static files"),
|
|
63
|
+
(" findstatic", "Find static file locations"),
|
|
64
|
+
("", ""),
|
|
65
|
+
("Maintenance:", ""),
|
|
66
|
+
(" clearsessions", "Clear expired sessions"),
|
|
67
|
+
(" flush", "Remove all data from database"),
|
|
68
|
+
(" dumpdata", "Export data from database"),
|
|
69
|
+
(" loaddata", "Import data to database"),
|
|
70
|
+
("", ""),
|
|
71
|
+
("Inspection:", ""),
|
|
72
|
+
(" check", "Check for project issues"),
|
|
73
|
+
(" diffsettings", "Display differences between settings and defaults"),
|
|
74
|
+
(" inspectdb", "Generate models from database"),
|
|
75
|
+
(" showmigrations", "Show migration status"),
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
for cmd, desc in commands:
|
|
79
|
+
if desc:
|
|
80
|
+
print(f"{cmd.ljust(20)} {desc}")
|
|
81
|
+
else:
|
|
82
|
+
print(f"\n{cmd}")
|
|
83
|
+
|
|
84
|
+
print("\nFor full Django documentation, visit: https://docs.djangoproject.com/en/stable/ref/django-admin/")
|
|
85
|
+
print("\nExample usage:\n quickscale manage migrate")
|
|
86
|
+
print(" quickscale manage test users")
|
|
87
|
+
|
|
88
|
+
# Main CLI entry point with subcommand routing
|
|
89
|
+
def main():
|
|
90
|
+
parser = argparse.ArgumentParser(description="QuickScale CLI")
|
|
91
|
+
subparsers = parser.add_subparsers(dest="command", help="Commands")
|
|
92
|
+
|
|
93
|
+
# Build command
|
|
94
|
+
build_parser = subparsers.add_parser("build", help="Build a new QuickScale project")
|
|
95
|
+
build_parser.add_argument("name", help="Project name")
|
|
96
|
+
|
|
97
|
+
# Service management commands
|
|
98
|
+
up_parser = subparsers.add_parser("up", help="Start the project services")
|
|
99
|
+
down_parser = subparsers.add_parser("down", help="Stop the project services")
|
|
100
|
+
destroy_parser = subparsers.add_parser("destroy", help="Destroy the current project")
|
|
101
|
+
check_parser = subparsers.add_parser("check", help="Check project status and requirements")
|
|
102
|
+
clean_parser = subparsers.add_parser("clean", help="Clean temporary files and cached data")
|
|
103
|
+
|
|
104
|
+
# Logs command with optional service filter
|
|
105
|
+
logs_parser = subparsers.add_parser("logs", help="View project logs")
|
|
106
|
+
logs_parser.add_argument("service", nargs="?", choices=["web", "db"], help="Optional service to view logs for")
|
|
107
|
+
|
|
108
|
+
# Django management command pass-through
|
|
109
|
+
manage_parser = subparsers.add_parser("manage", help="Run Django management commands")
|
|
110
|
+
manage_parser.add_argument("args", nargs=argparse.REMAINDER, help="Arguments to pass to manage.py")
|
|
111
|
+
|
|
112
|
+
# Project maintenance commands
|
|
113
|
+
update_parser = subparsers.add_parser("update", help="Update project dependencies and configuration")
|
|
114
|
+
ps_parser = subparsers.add_parser("ps", help="Show the status of running services")
|
|
115
|
+
|
|
116
|
+
# Help and version commands
|
|
117
|
+
help_parser = subparsers.add_parser("help", help="Show this help message")
|
|
118
|
+
help_parser.add_argument("topic", nargs="?", help="Topic to get help for (e.g., 'manage')")
|
|
119
|
+
version_parser = subparsers.add_parser("version", help="Show the current version of QuickScale")
|
|
120
|
+
|
|
121
|
+
args = parser.parse_args()
|
|
122
|
+
|
|
123
|
+
try:
|
|
124
|
+
if args.command == "build":
|
|
125
|
+
project_path = build_project(args.name)
|
|
126
|
+
print("\n📂 Project created in directory:")
|
|
127
|
+
print(f" {project_path}")
|
|
128
|
+
print("\n⚡ To enter your project directory, run:")
|
|
129
|
+
print(f" cd {args.name}")
|
|
130
|
+
print("\n🌐 Access your application at:")
|
|
131
|
+
print(" http://localhost:8000")
|
|
132
|
+
elif args.command == "up":
|
|
133
|
+
up()
|
|
134
|
+
elif args.command == "down":
|
|
135
|
+
down()
|
|
136
|
+
elif args.command == "destroy":
|
|
137
|
+
current_dir = os.path.basename(os.getcwd())
|
|
138
|
+
result = destroy()
|
|
139
|
+
|
|
140
|
+
if result and result.get('success', False):
|
|
141
|
+
parent_dir = os.path.dirname(os.getcwd())
|
|
142
|
+
print(f"\n⚡ You are still in the deleted project's directory path.")
|
|
143
|
+
print(f" To navigate to the parent directory, run:")
|
|
144
|
+
print(f" cd ..")
|
|
145
|
+
elif args.command == "check":
|
|
146
|
+
check()
|
|
147
|
+
elif args.command == "clean":
|
|
148
|
+
clean()
|
|
149
|
+
elif args.command == "logs":
|
|
150
|
+
logs(args.service)
|
|
151
|
+
elif args.command == "manage":
|
|
152
|
+
# Check if this is a help request for manage
|
|
153
|
+
if args.args and args.args[0] in ['help', '--help', '-h']:
|
|
154
|
+
manage_help()
|
|
155
|
+
else:
|
|
156
|
+
manage(args.args)
|
|
157
|
+
elif args.command == "update":
|
|
158
|
+
update()
|
|
159
|
+
elif args.command == "ps":
|
|
160
|
+
ps()
|
|
161
|
+
elif args.command == "help":
|
|
162
|
+
if hasattr(args, 'topic') and args.topic == "manage":
|
|
163
|
+
manage_help()
|
|
164
|
+
else:
|
|
165
|
+
parser.print_help()
|
|
166
|
+
print("\nFor Django management commands help, use:")
|
|
167
|
+
print(" quickscale help manage")
|
|
168
|
+
print(" quickscale manage help")
|
|
169
|
+
elif args.command == "version":
|
|
170
|
+
print(f"QuickScale version {__version__}")
|
|
171
|
+
else:
|
|
172
|
+
parser.print_help()
|
|
173
|
+
return 1
|
|
174
|
+
return 0
|
|
175
|
+
except Exception as e:
|
|
176
|
+
print(f"Error: {e}")
|
|
177
|
+
return 1
|
|
178
|
+
|
|
179
|
+
if __name__ == "__main__":
|
|
180
|
+
exit(main())
|
|
Binary file
|
|
Binary file
|
|
Binary file
|