createsonline 0.1.26__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.
- createsonline/__init__.py +46 -0
- createsonline/admin/__init__.py +7 -0
- createsonline/admin/content.py +526 -0
- createsonline/admin/crud.py +805 -0
- createsonline/admin/field_builder.py +559 -0
- createsonline/admin/integration.py +482 -0
- createsonline/admin/interface.py +2562 -0
- createsonline/admin/model_creator.py +513 -0
- createsonline/admin/model_manager.py +388 -0
- createsonline/admin/modern_dashboard.py +498 -0
- createsonline/admin/permissions.py +264 -0
- createsonline/admin/user_forms.py +594 -0
- createsonline/ai/__init__.py +202 -0
- createsonline/ai/fields.py +1226 -0
- createsonline/ai/orm.py +325 -0
- createsonline/ai/services.py +1244 -0
- createsonline/app.py +506 -0
- createsonline/auth/__init__.py +8 -0
- createsonline/auth/management.py +228 -0
- createsonline/auth/models.py +552 -0
- createsonline/cli/__init__.py +5 -0
- createsonline/cli/commands/__init__.py +122 -0
- createsonline/cli/commands/database.py +416 -0
- createsonline/cli/commands/info.py +173 -0
- createsonline/cli/commands/initdb.py +218 -0
- createsonline/cli/commands/project.py +545 -0
- createsonline/cli/commands/serve.py +173 -0
- createsonline/cli/commands/shell.py +93 -0
- createsonline/cli/commands/users.py +148 -0
- createsonline/cli/main.py +2041 -0
- createsonline/cli/manage.py +274 -0
- createsonline/config/__init__.py +9 -0
- createsonline/config/app.py +2577 -0
- createsonline/config/database.py +179 -0
- createsonline/config/docs.py +384 -0
- createsonline/config/errors.py +160 -0
- createsonline/config/orm.py +43 -0
- createsonline/config/request.py +93 -0
- createsonline/config/settings.py +176 -0
- createsonline/data/__init__.py +23 -0
- createsonline/data/dataframe.py +925 -0
- createsonline/data/io.py +453 -0
- createsonline/data/series.py +557 -0
- createsonline/database/__init__.py +60 -0
- createsonline/database/abstraction.py +440 -0
- createsonline/database/assistant.py +585 -0
- createsonline/database/fields.py +442 -0
- createsonline/database/migrations.py +132 -0
- createsonline/database/models.py +604 -0
- createsonline/database.py +438 -0
- createsonline/http/__init__.py +28 -0
- createsonline/http/client.py +535 -0
- createsonline/ml/__init__.py +55 -0
- createsonline/ml/classification.py +552 -0
- createsonline/ml/clustering.py +680 -0
- createsonline/ml/metrics.py +542 -0
- createsonline/ml/neural.py +560 -0
- createsonline/ml/preprocessing.py +784 -0
- createsonline/ml/regression.py +501 -0
- createsonline/performance/__init__.py +19 -0
- createsonline/performance/cache.py +444 -0
- createsonline/performance/compression.py +335 -0
- createsonline/performance/core.py +419 -0
- createsonline/project_init.py +789 -0
- createsonline/routing.py +528 -0
- createsonline/security/__init__.py +34 -0
- createsonline/security/core.py +811 -0
- createsonline/security/encryption.py +349 -0
- createsonline/server.py +295 -0
- createsonline/static/css/admin.css +263 -0
- createsonline/static/css/common.css +358 -0
- createsonline/static/css/dashboard.css +89 -0
- createsonline/static/favicon.ico +0 -0
- createsonline/static/icons/icon-128x128.png +0 -0
- createsonline/static/icons/icon-128x128.webp +0 -0
- createsonline/static/icons/icon-16x16.png +0 -0
- createsonline/static/icons/icon-16x16.webp +0 -0
- createsonline/static/icons/icon-180x180.png +0 -0
- createsonline/static/icons/icon-180x180.webp +0 -0
- createsonline/static/icons/icon-192x192.png +0 -0
- createsonline/static/icons/icon-192x192.webp +0 -0
- createsonline/static/icons/icon-256x256.png +0 -0
- createsonline/static/icons/icon-256x256.webp +0 -0
- createsonline/static/icons/icon-32x32.png +0 -0
- createsonline/static/icons/icon-32x32.webp +0 -0
- createsonline/static/icons/icon-384x384.png +0 -0
- createsonline/static/icons/icon-384x384.webp +0 -0
- createsonline/static/icons/icon-48x48.png +0 -0
- createsonline/static/icons/icon-48x48.webp +0 -0
- createsonline/static/icons/icon-512x512.png +0 -0
- createsonline/static/icons/icon-512x512.webp +0 -0
- createsonline/static/icons/icon-64x64.png +0 -0
- createsonline/static/icons/icon-64x64.webp +0 -0
- createsonline/static/image/android-chrome-192x192.png +0 -0
- createsonline/static/image/android-chrome-512x512.png +0 -0
- createsonline/static/image/apple-touch-icon.png +0 -0
- createsonline/static/image/favicon-16x16.png +0 -0
- createsonline/static/image/favicon-32x32.png +0 -0
- createsonline/static/image/favicon.ico +0 -0
- createsonline/static/image/favicon.svg +17 -0
- createsonline/static/image/icon-128x128.png +0 -0
- createsonline/static/image/icon-128x128.webp +0 -0
- createsonline/static/image/icon-16x16.png +0 -0
- createsonline/static/image/icon-16x16.webp +0 -0
- createsonline/static/image/icon-180x180.png +0 -0
- createsonline/static/image/icon-180x180.webp +0 -0
- createsonline/static/image/icon-192x192.png +0 -0
- createsonline/static/image/icon-192x192.webp +0 -0
- createsonline/static/image/icon-256x256.png +0 -0
- createsonline/static/image/icon-256x256.webp +0 -0
- createsonline/static/image/icon-32x32.png +0 -0
- createsonline/static/image/icon-32x32.webp +0 -0
- createsonline/static/image/icon-384x384.png +0 -0
- createsonline/static/image/icon-384x384.webp +0 -0
- createsonline/static/image/icon-48x48.png +0 -0
- createsonline/static/image/icon-48x48.webp +0 -0
- createsonline/static/image/icon-512x512.png +0 -0
- createsonline/static/image/icon-512x512.webp +0 -0
- createsonline/static/image/icon-64x64.png +0 -0
- createsonline/static/image/icon-64x64.webp +0 -0
- createsonline/static/image/logo-header-h100.png +0 -0
- createsonline/static/image/logo-header-h100.webp +0 -0
- createsonline/static/image/logo-header-h200@2x.png +0 -0
- createsonline/static/image/logo-header-h200@2x.webp +0 -0
- createsonline/static/image/logo.png +0 -0
- createsonline/static/js/admin.js +274 -0
- createsonline/static/site.webmanifest +35 -0
- createsonline/static/templates/admin/base.html +87 -0
- createsonline/static/templates/admin/dashboard.html +217 -0
- createsonline/static/templates/admin/model_form.html +270 -0
- createsonline/static/templates/admin/model_list.html +202 -0
- createsonline/static/test_script.js +15 -0
- createsonline/static/test_styles.css +59 -0
- createsonline/static_files.py +365 -0
- createsonline/templates/404.html +100 -0
- createsonline/templates/admin_login.html +169 -0
- createsonline/templates/base.html +102 -0
- createsonline/templates/index.html +151 -0
- createsonline/templates.py +205 -0
- createsonline/testing.py +322 -0
- createsonline/utils.py +448 -0
- createsonline/validation/__init__.py +49 -0
- createsonline/validation/fields.py +598 -0
- createsonline/validation/models.py +504 -0
- createsonline/validation/validators.py +561 -0
- createsonline/views.py +184 -0
- createsonline-0.1.26.dist-info/METADATA +46 -0
- createsonline-0.1.26.dist-info/RECORD +152 -0
- createsonline-0.1.26.dist-info/WHEEL +5 -0
- createsonline-0.1.26.dist-info/entry_points.txt +2 -0
- createsonline-0.1.26.dist-info/licenses/LICENSE +21 -0
- createsonline-0.1.26.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
# createsonline/cli/commands/project.py
|
|
2
|
+
"""
|
|
3
|
+
CREATESONLINE Project Commands
|
|
4
|
+
|
|
5
|
+
Create new projects with AI features.
|
|
6
|
+
"""
|
|
7
|
+
import typer
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from rich.console import Console
|
|
10
|
+
from rich.panel import Panel
|
|
11
|
+
from rich.progress import Progress, SpinnerColumn, TextColumn
|
|
12
|
+
|
|
13
|
+
console = Console()
|
|
14
|
+
|
|
15
|
+
def new_command(
|
|
16
|
+
name: str = typer.Argument(..., help="Project name"),
|
|
17
|
+
template: str = typer.Option("basic", "--template", "-t", help="Project template (basic, ai-full, api-only)"),
|
|
18
|
+
directory: str = typer.Option(None, "--dir", "-d", help="Directory to create project in"),
|
|
19
|
+
):
|
|
20
|
+
"""✨ Create new CREATESONLINE project with AI features"""
|
|
21
|
+
|
|
22
|
+
# Determine project directory
|
|
23
|
+
if directory:
|
|
24
|
+
project_dir = Path(directory) / name
|
|
25
|
+
else:
|
|
26
|
+
project_dir = Path.cwd() / name
|
|
27
|
+
|
|
28
|
+
console.print(Panel(
|
|
29
|
+
f"[bold green]Creating CREATESONLINE Project[/bold green]\n\n"
|
|
30
|
+
f"[cyan]Name:[/cyan] {name}\n"
|
|
31
|
+
f"[cyan]Template:[/cyan] {template}\n"
|
|
32
|
+
f"[cyan]Directory:[/cyan] {project_dir}\n"
|
|
33
|
+
f"[cyan]Features:[/cyan] AI Fields, Admin Interface, CLI",
|
|
34
|
+
title="✨ Project Generator",
|
|
35
|
+
border_style="green"
|
|
36
|
+
))
|
|
37
|
+
|
|
38
|
+
# Check if directory exists
|
|
39
|
+
if project_dir.exists():
|
|
40
|
+
console.print(f"[red]Error: Directory {project_dir} already exists![/red]")
|
|
41
|
+
raise typer.Exit(1)
|
|
42
|
+
|
|
43
|
+
# Create project with progress
|
|
44
|
+
with Progress(
|
|
45
|
+
SpinnerColumn(),
|
|
46
|
+
TextColumn("[progress.description]{task.description}"),
|
|
47
|
+
console=console
|
|
48
|
+
) as progress:
|
|
49
|
+
|
|
50
|
+
# Create directories
|
|
51
|
+
task = progress.add_task("Creating project structure...", total=None)
|
|
52
|
+
try:
|
|
53
|
+
create_project_structure(project_dir, name, template)
|
|
54
|
+
progress.update(task, description="✅ Project structure created")
|
|
55
|
+
|
|
56
|
+
# Generate files
|
|
57
|
+
progress.update(task, description="Generating project files...")
|
|
58
|
+
generate_project_files(project_dir, name, template)
|
|
59
|
+
progress.update(task, description="✅ Project files generated")
|
|
60
|
+
|
|
61
|
+
# Create virtual environment suggestion
|
|
62
|
+
progress.update(task, description="✅ Project created successfully!")
|
|
63
|
+
|
|
64
|
+
except Exception as e:
|
|
65
|
+
console.print(f"[red]Error creating project: {e}[/red]")
|
|
66
|
+
raise typer.Exit(1)
|
|
67
|
+
|
|
68
|
+
# Success message
|
|
69
|
+
success_panel = Panel(
|
|
70
|
+
f"[bold green]🎉 Project '{name}' created successfully![/bold green]\n\n"
|
|
71
|
+
"[cyan]Next steps:[/cyan]\n"
|
|
72
|
+
f"1. [yellow]cd {name}[/yellow]\n"
|
|
73
|
+
"2. [yellow]python -m venv venv[/yellow]\n"
|
|
74
|
+
"3. [yellow]source venv/bin/activate[/yellow] # or venv\\Scripts\\activate on Windows\n"
|
|
75
|
+
"4. [yellow]pip install -r requirements.txt[/yellow]\n"
|
|
76
|
+
"5. [yellow]createsonline serve[/yellow]\n\n"
|
|
77
|
+
"[green]Visit:[/green] http://localhost:8000",
|
|
78
|
+
title="🚀 Ready to Go!",
|
|
79
|
+
border_style="green"
|
|
80
|
+
)
|
|
81
|
+
console.print(success_panel)
|
|
82
|
+
|
|
83
|
+
def create_project_structure(project_dir: Path, name: str, template: str):
|
|
84
|
+
"""Create the project directory structure"""
|
|
85
|
+
|
|
86
|
+
# Create main project directory
|
|
87
|
+
project_dir.mkdir(parents=True, exist_ok=True)
|
|
88
|
+
|
|
89
|
+
# Create subdirectories based on template
|
|
90
|
+
directories = [
|
|
91
|
+
"static",
|
|
92
|
+
"templates",
|
|
93
|
+
"models",
|
|
94
|
+
"api",
|
|
95
|
+
"tests"
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
if template in ["ai-full", "full"]:
|
|
99
|
+
directories.extend([
|
|
100
|
+
"ai",
|
|
101
|
+
"ml_models",
|
|
102
|
+
"data"
|
|
103
|
+
])
|
|
104
|
+
|
|
105
|
+
for dir_name in directories:
|
|
106
|
+
(project_dir / dir_name).mkdir(exist_ok=True)
|
|
107
|
+
# Create __init__.py for Python packages
|
|
108
|
+
if dir_name in ["models", "api", "ai"]:
|
|
109
|
+
(project_dir / dir_name / "__init__.py").write_text("")
|
|
110
|
+
|
|
111
|
+
def generate_project_files(project_dir: Path, name: str, template: str):
|
|
112
|
+
"""Generate project files based on template"""
|
|
113
|
+
|
|
114
|
+
# Generate main.py
|
|
115
|
+
main_py_content = generate_main_py(name, template)
|
|
116
|
+
(project_dir / "main.py").write_text(main_py_content)
|
|
117
|
+
|
|
118
|
+
# Generate requirements.txt
|
|
119
|
+
requirements_content = generate_requirements(template)
|
|
120
|
+
(project_dir / "requirements.txt").write_text(requirements_content)
|
|
121
|
+
|
|
122
|
+
# Generate .env
|
|
123
|
+
env_content = generate_env_file(name)
|
|
124
|
+
(project_dir / ".env").write_text(env_content)
|
|
125
|
+
|
|
126
|
+
# Generate README.md
|
|
127
|
+
readme_content = generate_readme(name, template)
|
|
128
|
+
(project_dir / "README.md").write_text(readme_content)
|
|
129
|
+
|
|
130
|
+
# Generate .gitignore
|
|
131
|
+
gitignore_content = generate_gitignore()
|
|
132
|
+
(project_dir / ".gitignore").write_text(gitignore_content)
|
|
133
|
+
|
|
134
|
+
# Template-specific files
|
|
135
|
+
if template in ["ai-full", "full"]:
|
|
136
|
+
# Generate AI model examples
|
|
137
|
+
ai_models_content = generate_ai_models(name)
|
|
138
|
+
(project_dir / "models" / "ai_models.py").write_text(ai_models_content)
|
|
139
|
+
|
|
140
|
+
# Generate AI routes
|
|
141
|
+
ai_routes_content = generate_ai_routes()
|
|
142
|
+
(project_dir / "api" / "ai_routes.py").write_text(ai_routes_content)
|
|
143
|
+
|
|
144
|
+
def generate_main_py(name: str, template: str) -> str:
|
|
145
|
+
"""Generate main.py file - Pure Independence Version"""
|
|
146
|
+
|
|
147
|
+
if template == "basic":
|
|
148
|
+
return f'''#!/usr/bin/env python3
|
|
149
|
+
"""
|
|
150
|
+
{name} - Pure CREATESONLINE Application
|
|
151
|
+
|
|
152
|
+
Pure independence CREATESONLINE application with internal implementations only.
|
|
153
|
+
Zero external web framework dependencies - Pure ASGI implementation.
|
|
154
|
+
"""
|
|
155
|
+
from createsonline.config.app import CreatesonlineApp
|
|
156
|
+
from createsonline.database import Database
|
|
157
|
+
import os
|
|
158
|
+
|
|
159
|
+
# Create pure CREATESONLINE application (no external frameworks)
|
|
160
|
+
app = CreatesonlineApp(
|
|
161
|
+
title="{name.title()}",
|
|
162
|
+
description="A pure CREATESONLINE application - Zero external dependencies",
|
|
163
|
+
version="1.0.0",
|
|
164
|
+
debug=False
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
# Initialize database with internal abstraction
|
|
168
|
+
db = Database(os.getenv("DATABASE_URL", "sqlite:///./app.db"))
|
|
169
|
+
|
|
170
|
+
@app.route("/", methods=["GET"])
|
|
171
|
+
async def home(request):
|
|
172
|
+
"""Home page - Pure internal implementation"""
|
|
173
|
+
return {{
|
|
174
|
+
"message": "Welcome to {name.title()}!",
|
|
175
|
+
"framework": "CREATESONLINE",
|
|
176
|
+
"template": "basic",
|
|
177
|
+
"independence": "Pure - Zero external web frameworks",
|
|
178
|
+
"dependencies": "Only 5 core essentials"
|
|
179
|
+
}}
|
|
180
|
+
|
|
181
|
+
@app.route("/health", methods=["GET"])
|
|
182
|
+
async def health(request):
|
|
183
|
+
"""Health check - Internal monitoring"""
|
|
184
|
+
return {{
|
|
185
|
+
"status": "healthy",
|
|
186
|
+
"framework": "CREATESONLINE Pure",
|
|
187
|
+
"database": "connected" if db.is_connected() else "disconnected"
|
|
188
|
+
}}
|
|
189
|
+
|
|
190
|
+
if __name__ == "__main__":
|
|
191
|
+
import uvicorn
|
|
192
|
+
uvicorn.run(app, host="0.0.0.0", port=8000, reload=True)
|
|
193
|
+
'''
|
|
194
|
+
|
|
195
|
+
elif template in ["ai-full", "full"]:
|
|
196
|
+
return f'''#!/usr/bin/env python3
|
|
197
|
+
"""
|
|
198
|
+
{name} - Pure AI-Native CREATESONLINE Application
|
|
199
|
+
|
|
200
|
+
Pure independence AI application with internal ML implementations.
|
|
201
|
+
Zero external ML framework dependencies - Native CREATESONLINE AI stack.
|
|
202
|
+
"""
|
|
203
|
+
from createsonline.config.app import CreatesonlineApp
|
|
204
|
+
from createsonline.database import Database
|
|
205
|
+
from createsonline.ai.services import AIService
|
|
206
|
+
from createsonline.ai.fields import AIComputedField, LLMField, VectorField
|
|
207
|
+
from createsonline.ai.orm import AIBaseModel
|
|
208
|
+
from createsonline.ml.neural import NeuralNetwork
|
|
209
|
+
from createsonline.ml.classification import Classifier
|
|
210
|
+
import os
|
|
211
|
+
|
|
212
|
+
# Create pure CREATESONLINE AI application (no external frameworks)
|
|
213
|
+
app = CreatesonlineApp(
|
|
214
|
+
title="{name.title()} AI",
|
|
215
|
+
description="Pure AI-native CREATESONLINE application - Zero external ML dependencies",
|
|
216
|
+
version="1.0.0",
|
|
217
|
+
debug=False
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
# Initialize with internal implementations only
|
|
221
|
+
db = Database(os.getenv("DATABASE_URL", "sqlite:///./app.db"))
|
|
222
|
+
ai = AIService() # Pure internal AI - no TensorFlow/PyTorch
|
|
223
|
+
|
|
224
|
+
@app.route("/", methods=["GET"])
|
|
225
|
+
async def home(request):
|
|
226
|
+
"""AI-powered home page - Pure internal implementation"""
|
|
227
|
+
return {{
|
|
228
|
+
"message": "Welcome to {name.title()} AI!",
|
|
229
|
+
"framework": "CREATESONLINE Pure AI",
|
|
230
|
+
"template": "ai-full",
|
|
231
|
+
"ai_features": [
|
|
232
|
+
"Internal AI-Computed Fields",
|
|
233
|
+
"Pure LLM Content Generation",
|
|
234
|
+
"Native Vector Embeddings",
|
|
235
|
+
"Internal Text Analysis"
|
|
236
|
+
],
|
|
237
|
+
"independence": "Pure - Zero external AI/ML dependencies"
|
|
238
|
+
}}
|
|
239
|
+
|
|
240
|
+
@app.route("/ai/demo", methods=["GET"])
|
|
241
|
+
async def ai_demo(request):
|
|
242
|
+
"""Demonstrate AI capabilities - Internal implementations"""
|
|
243
|
+
try:
|
|
244
|
+
# Use internal AI generation
|
|
245
|
+
sample_text = await ai.generate_text(
|
|
246
|
+
f"Write a tagline for {{name.title()}}",
|
|
247
|
+
max_tokens=50
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
# Get internal embedding
|
|
251
|
+
embedding = await ai.get_embedding("CREATESONLINE Pure AI Framework")
|
|
252
|
+
|
|
253
|
+
return {{
|
|
254
|
+
"ai_status": "✅ Working - Pure Internal",
|
|
255
|
+
"sample_text": sample_text,
|
|
256
|
+
"embedding_size": len(embedding),
|
|
257
|
+
"framework": "CREATESONLINE Pure AI"
|
|
258
|
+
}}
|
|
259
|
+
except Exception as e:
|
|
260
|
+
return {{
|
|
261
|
+
"ai_status": "⚠️ Limited Mode",
|
|
262
|
+
"error": str(e),
|
|
263
|
+
"framework": "CREATESONLINE Pure AI"
|
|
264
|
+
}}
|
|
265
|
+
|
|
266
|
+
@app.route("/ai/predict", methods=["POST"])
|
|
267
|
+
async def ai_predict(request):
|
|
268
|
+
"""AI prediction endpoint - Pure internal ML"""
|
|
269
|
+
try:
|
|
270
|
+
data = await request.json()
|
|
271
|
+
# Use internal neural network implementation
|
|
272
|
+
model = NeuralNetwork(layers=[10, 5, 1])
|
|
273
|
+
prediction = await ai.predict(model, data.get("features", []))
|
|
274
|
+
|
|
275
|
+
return {{
|
|
276
|
+
"prediction": prediction,
|
|
277
|
+
"model": "Internal Neural Network",
|
|
278
|
+
"framework": "CREATESONLINE Pure ML"
|
|
279
|
+
}}
|
|
280
|
+
except Exception as e:
|
|
281
|
+
return {{"error": str(e)}}, 400
|
|
282
|
+
|
|
283
|
+
@app.route("/health", methods=["GET"])
|
|
284
|
+
async def health(request):
|
|
285
|
+
"""AI system health check"""
|
|
286
|
+
return {{
|
|
287
|
+
"status": "healthy",
|
|
288
|
+
"framework": "CREATESONLINE Pure AI",
|
|
289
|
+
"ai_service": "active",
|
|
290
|
+
"database": "connected" if db.is_connected() else "disconnected",
|
|
291
|
+
"ai_enabled": True
|
|
292
|
+
}}
|
|
293
|
+
|
|
294
|
+
if __name__ == "__main__":
|
|
295
|
+
import uvicorn
|
|
296
|
+
uvicorn.run(app, host="0.0.0.0", port=8000, reload=True)
|
|
297
|
+
'''
|
|
298
|
+
|
|
299
|
+
else: # api-only
|
|
300
|
+
return f'''#!/usr/bin/env python3
|
|
301
|
+
"""
|
|
302
|
+
{name} - Pure CREATESONLINE API
|
|
303
|
+
|
|
304
|
+
API-only CREATESONLINE application with pure internal implementation.
|
|
305
|
+
Zero external framework dependencies - Pure ASGI implementation.
|
|
306
|
+
"""
|
|
307
|
+
from createsonline.config.app import CreatesonlineApp
|
|
308
|
+
from createsonline.database import Database
|
|
309
|
+
import os
|
|
310
|
+
|
|
311
|
+
# Create pure CREATESONLINE API application (no external frameworks)
|
|
312
|
+
app = CreatesonlineApp(
|
|
313
|
+
title="{name.title()} API",
|
|
314
|
+
description="Pure API built with CREATESONLINE - Zero external dependencies",
|
|
315
|
+
version="1.0.0",
|
|
316
|
+
debug=False
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
# Initialize database with internal abstraction
|
|
320
|
+
db = Database(os.getenv("DATABASE_URL", "sqlite:///./app.db"))
|
|
321
|
+
|
|
322
|
+
@app.route("/api/v1/status", methods=["GET"])
|
|
323
|
+
async def api_status(request):
|
|
324
|
+
"""API status - Pure internal implementation"""
|
|
325
|
+
return {{
|
|
326
|
+
"service": "{name.title()} API",
|
|
327
|
+
"status": "operational",
|
|
328
|
+
"version": "1.0.0",
|
|
329
|
+
"framework": "CREATESONLINE Pure API",
|
|
330
|
+
"independence": "Pure - Zero external web frameworks"
|
|
331
|
+
}}
|
|
332
|
+
|
|
333
|
+
@app.route("/api/v1/health", methods=["GET"])
|
|
334
|
+
async def api_health(request):
|
|
335
|
+
"""API health check - Internal monitoring"""
|
|
336
|
+
return {{
|
|
337
|
+
"status": "healthy",
|
|
338
|
+
"framework": "CREATESONLINE Pure API",
|
|
339
|
+
"database": "connected" if db.is_connected() else "disconnected",
|
|
340
|
+
"dependencies": "Only 5 core essentials"
|
|
341
|
+
}}
|
|
342
|
+
|
|
343
|
+
if __name__ == "__main__":
|
|
344
|
+
import uvicorn
|
|
345
|
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
346
|
+
'''
|
|
347
|
+
|
|
348
|
+
def generate_requirements(template: str) -> str:
|
|
349
|
+
"""Generate requirements.txt - Pure Independence Version"""
|
|
350
|
+
|
|
351
|
+
base_requirements = [
|
|
352
|
+
"# CREATESONLINE Framework - Pure Independence Requirements",
|
|
353
|
+
"# Only the absolute essentials that are too complex to rebuild",
|
|
354
|
+
"",
|
|
355
|
+
"# ========================================",
|
|
356
|
+
"# CORE ESSENTIALS (Cannot reasonably rebuild)",
|
|
357
|
+
"# ========================================",
|
|
358
|
+
"",
|
|
359
|
+
"# ASGI Server (minimal - no extras)",
|
|
360
|
+
"uvicorn>=0.24.0,<1.0.0",
|
|
361
|
+
"",
|
|
362
|
+
"# Database ORM (too complex to rebuild)",
|
|
363
|
+
"sqlalchemy>=2.0.0,<3.0.0",
|
|
364
|
+
"alembic>=1.12.0,<2.0.0 # Database migrations",
|
|
365
|
+
"",
|
|
366
|
+
"# Math/AI Foundation (essential for vectors/AI)",
|
|
367
|
+
"numpy>=1.24.0,<2.0.0",
|
|
368
|
+
"",
|
|
369
|
+
"# Environment Variables (simple utility)",
|
|
370
|
+
"python-dotenv>=1.0.0,<2.0.0",
|
|
371
|
+
"",
|
|
372
|
+
"# ========================================",
|
|
373
|
+
"# TOTAL: 5 CORE DEPENDENCIES",
|
|
374
|
+
"# ========================================",
|
|
375
|
+
""
|
|
376
|
+
]
|
|
377
|
+
|
|
378
|
+
if template in ["ai-full", "full"]:
|
|
379
|
+
ai_requirements = [
|
|
380
|
+
"# ========================================",
|
|
381
|
+
"# OPTIONAL AI ENHANCEMENTS",
|
|
382
|
+
"# ========================================",
|
|
383
|
+
"",
|
|
384
|
+
"# External AI APIs (optional)",
|
|
385
|
+
"# openai>=1.0.0 # Uncomment if using OpenAI",
|
|
386
|
+
"# anthropic>=0.18.0 # Uncomment if using Claude",
|
|
387
|
+
"",
|
|
388
|
+
"# ========================================",
|
|
389
|
+
"# EVERYTHING ELSE: BUILT INTERNALLY",
|
|
390
|
+
"# ========================================",
|
|
391
|
+
"# ❌ REMOVED: pydantic (internal validation)",
|
|
392
|
+
"# ❌ REMOVED: pandas (internal data structures)",
|
|
393
|
+
"# ❌ REMOVED: scikit-learn (internal ML)",
|
|
394
|
+
"# ❌ REMOVED: requests/httpx (internal HTTP client)",
|
|
395
|
+
"# ❌ REMOVED: typer/rich (internal CLI with fallbacks)",
|
|
396
|
+
""
|
|
397
|
+
]
|
|
398
|
+
base_requirements.extend(ai_requirements)
|
|
399
|
+
|
|
400
|
+
dev_requirements = [
|
|
401
|
+
"# Development",
|
|
402
|
+
"pytest>=7.0.0",
|
|
403
|
+
"pytest-asyncio>=0.21.0",
|
|
404
|
+
"black>=23.0.0",
|
|
405
|
+
"isort>=5.12.0"
|
|
406
|
+
]
|
|
407
|
+
base_requirements.extend(dev_requirements)
|
|
408
|
+
|
|
409
|
+
return "\n".join(base_requirements)
|
|
410
|
+
|
|
411
|
+
def generate_env_file(name: str) -> str:
|
|
412
|
+
"""Generate .env file"""
|
|
413
|
+
return f'''# {name.title()} Environment Configuration
|
|
414
|
+
|
|
415
|
+
# Server Configuration
|
|
416
|
+
HOST=0.0.0.0
|
|
417
|
+
PORT=3000
|
|
418
|
+
ENV=development
|
|
419
|
+
WORKERS=1
|
|
420
|
+
|
|
421
|
+
# Database Configuration
|
|
422
|
+
DATABASE_URL=sqlite:///./app.db
|
|
423
|
+
|
|
424
|
+
# AI Configuration (Optional - for real AI features)
|
|
425
|
+
# OPENAI_API_KEY=your_openai_key_here
|
|
426
|
+
# ANTHROPIC_API_KEY=your_anthropic_key_here
|
|
427
|
+
|
|
428
|
+
# Security
|
|
429
|
+
SECRET_KEY=your-secret-key-here-change-in-production
|
|
430
|
+
|
|
431
|
+
# Debug
|
|
432
|
+
DEBUG=true
|
|
433
|
+
'''
|
|
434
|
+
|
|
435
|
+
def generate_readme(name: str, template: str) -> str:
|
|
436
|
+
"""Generate README.md"""
|
|
437
|
+
|
|
438
|
+
ai_section = ""
|
|
439
|
+
if template in ["ai-full", "full"]:
|
|
440
|
+
ai_section = f'''
|
|
441
|
+
## C⎯● AI Features
|
|
442
|
+
|
|
443
|
+
This project includes AI capabilities:
|
|
444
|
+
|
|
445
|
+
- **AI-Computed Fields**: Automatic ML predictions
|
|
446
|
+
- **LLM Content Generation**: GPT/Claude integration
|
|
447
|
+
- **Vector Embeddings**: Semantic similarity search
|
|
448
|
+
- **Smart Text Analysis**: Sentiment, keywords, language detection
|
|
449
|
+
|
|
450
|
+
### Configure AI Services
|
|
451
|
+
|
|
452
|
+
Add your API keys to `.env`:
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
OPENAI_API_KEY=your_key_here
|
|
456
|
+
ANTHROPIC_API_KEY=your_key_here
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
### AI Endpoints
|
|
460
|
+
|
|
461
|
+
- `GET /ai/demo` - Demonstrate AI capabilities
|
|
462
|
+
- `POST /ai/generate` - Generate content with LLM
|
|
463
|
+
- `POST /ai/analyze` - Analyze text with AI
|
|
464
|
+
'''
|
|
465
|
+
|
|
466
|
+
return f'''# {name.title()}
|
|
467
|
+
|
|
468
|
+
A powerful application built with **CREATESONLINE** - The AI-Native Web Framework.
|
|
469
|
+
|
|
470
|
+
## 🚀 Quick Start
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
# 1. Create virtual environment
|
|
474
|
+
python -m venv venv
|
|
475
|
+
source venv/bin/activate # or venv\\Scripts\\activate on Windows
|
|
476
|
+
|
|
477
|
+
# 2. Install dependencies
|
|
478
|
+
pip install -r requirements.txt
|
|
479
|
+
|
|
480
|
+
# 3. Install CREATESONLINE CLI (if not already installed)
|
|
481
|
+
pip install -e .
|
|
482
|
+
|
|
483
|
+
# 4. Start development server
|
|
484
|
+
createsonline serve
|
|
485
|
+
# or
|
|
486
|
+
python main.py
|
|
487
|
+
|
|
488
|
+
# 5. Visit your app
|
|
489
|
+
open http://localhost:8000
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
## 📁 Project Structure
|
|
493
|
+
|
|
494
|
+
```
|
|
495
|
+
{name}/
|
|
496
|
+
├── main.py # Main application
|
|
497
|
+
├── requirements.txt # Dependencies
|
|
498
|
+
├── .env # Environment configuration
|
|
499
|
+
├── models/ # Data models
|
|
500
|
+
├── api/ # API routes
|
|
501
|
+
├── static/ # Static files
|
|
502
|
+
├── templates/ # HTML templates
|
|
503
|
+
└── tests/ # Test files
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
## 🛠️ Development Commands
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
# Development server with auto-reload
|
|
510
|
+
createsonline dev
|
|
511
|
+
|
|
512
|
+
# Production server
|
|
513
|
+
createsonline prod --workers 4
|
|
514
|
+
|
|
515
|
+
# Framework information
|
|
516
|
+
createsonline info
|
|
517
|
+
|
|
518
|
+
# Interactive shell
|
|
519
|
+
createsonline shell
|
|
520
|
+
|
|
521
|
+
# Create admin user
|
|
522
|
+
createsonline createsuperuser
|
|
523
|
+
```
|
|
524
|
+
{ai_section}
|
|
525
|
+
## 📚 Documentation
|
|
526
|
+
|
|
527
|
+
- [CREATESONLINE Docs](https://docs.createsonline.com)
|
|
528
|
+
- [API Documentation](http://localhost:8000/createsonline/docs) (when running)
|
|
529
|
+
|
|
530
|
+
## 🤝 Contributing
|
|
531
|
+
|
|
532
|
+
1. Fork the repository
|
|
533
|
+
2. Create your feature branch
|
|
534
|
+
3. Make your changes
|
|
535
|
+
4. Add tests
|
|
536
|
+
5. Submit a pull request
|
|
537
|
+
|
|
538
|
+
## 📄 License
|
|
539
|
+
|
|
540
|
+
MIT License - see LICENSE file for details.
|
|
541
|
+
|
|
542
|
+
---
|
|
543
|
+
|
|
544
|
+
Built with ❤️ using [CREATESONLINE](https://createsonline.com) - Build Intelligence Into Everything.
|
|
545
|
+
'''
|