Marv12 commited on
Commit
551e537
·
verified ·
1 Parent(s): ccab05a

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +542 -18
  3. prompts.txt +0 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Sma
3
- emoji: 👀
4
- colorFrom: blue
5
- colorTo: yellow
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: sma
3
+ emoji: 🐳
4
+ colorFrom: gray
5
+ colorTo: blue
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,543 @@
1
- <!doctype html>
2
  <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
  <html>
3
+ <head>
4
+ <title>Temu Clone - Backend Setup</title>
5
+ <style>
6
+ body {
7
+ font-family: Arial, sans-serif;
8
+ line-height: 1.6;
9
+ margin: 0;
10
+ padding: 20px;
11
+ background-color: #f5f5f5;
12
+ }
13
+ .container {
14
+ max-width: 1200px;
15
+ margin: 0 auto;
16
+ background: white;
17
+ padding: 20px;
18
+ border-radius: 5px;
19
+ box-shadow: 0 0 10px rgba(0,0,0,0.1);
20
+ }
21
+ h1, h2, h3 {
22
+ color: #333;
23
+ }
24
+ code {
25
+ background: #f4f4f4;
26
+ padding: 2px 5px;
27
+ border-radius: 3px;
28
+ font-family: monospace;
29
+ }
30
+ pre {
31
+ background: #333;
32
+ color: #fff;
33
+ padding: 10px;
34
+ border-radius: 5px;
35
+ overflow-x: auto;
36
+ }
37
+ .section {
38
+ margin-bottom: 30px;
39
+ padding-bottom: 20px;
40
+ border-bottom: 1px solid #eee;
41
+ }
42
+ .note {
43
+ background: #fffde7;
44
+ padding: 10px;
45
+ border-left: 4px solid #ffd600;
46
+ margin: 10px 0;
47
+ }
48
+ </style>
49
+ </head>
50
+ <body>
51
+ <div class="container">
52
+ <h1>Temu Clone - Backend Setup</h1>
53
+
54
+ <div class="section">
55
+ <h2>1. Backend Setup</h2>
56
+
57
+ <h3>Python Requirements</h3>
58
+ <p>Create a <code>requirements.txt</code> file:</p>
59
+ <pre>
60
+ Flask==2.3.2
61
+ Flask-SQLAlchemy==3.0.3
62
+ Flask-Login==0.6.2
63
+ Flask-Admin==1.6.1
64
+ Flask-WTF==1.0.1
65
+ python-dotenv==1.0.0
66
+ Pillow==9.5.0
67
+ </pre>
68
+
69
+ <h3>Configuration</h3>
70
+ <p>Create <code>config.py</code>:</p>
71
+ <pre>
72
+ import os
73
+ from dotenv import load_dotenv
74
+
75
+ load_dotenv()
76
+
77
+ class Config:
78
+ SECRET_KEY = os.getenv('SECRET_KEY') or 'your-secret-key-here'
79
+ SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL') or 'sqlite:///site.db'
80
+ SQLALCHEMY_TRACK_MODIFICATIONS = False
81
+ UPLOAD_FOLDER = 'uploads'
82
+ ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
83
+
84
+ # Admin credentials
85
+ ADMIN_EMAIL = os.getenv('ADMIN_EMAIL') or 'admin@example.com'
86
+ ADMIN_PASSWORD = os.getenv('ADMIN_PASSWORD') or 'admin123'
87
+ </pre>
88
+
89
+ <h3>Database Models</h3>
90
+ <p>Create <code>models.py</code>:</p>
91
+ <pre>
92
+ from datetime import datetime
93
+ from flask_sqlalchemy import SQLAlchemy
94
+ from flask_login import UserMixin
95
+ from werkzeug.security import generate_password_hash, check_password_hash
96
+
97
+ db = SQLAlchemy()
98
+
99
+ class User(db.Model, UserMixin):
100
+ id = db.Column(db.Integer, primary_key=True)
101
+ username = db.Column(db.String(50), unique=True, nullable=False)
102
+ email = db.Column(db.String(120), unique=True, nullable=False)
103
+ password_hash = db.Column(db.String(128))
104
+ is_admin = db.Column(db.Boolean, default=False)
105
+ date_created = db.Column(db.DateTime, default=datetime.utcnow)
106
+ orders = db.relationship('Order', backref='customer', lazy=True)
107
+
108
+ def set_password(self, password):
109
+ self.password_hash = generate_password_hash(password)
110
+
111
+ def check_password(self, password):
112
+ return check_password_hash(self.password_hash, password)
113
+
114
+ class Product(db.Model):
115
+ id = db.Column(db.Integer, primary_key=True)
116
+ name = db.Column(db.String(100), nullable=False)
117
+ description = db.Column(db.Text)
118
+ price = db.Column(db.Float, nullable=False)
119
+ original_price = db.Column(db.Float)
120
+ image = db.Column(db.String(100))
121
+ category = db.Column(db.String(50))
122
+ flash_sale = db.Column(db.Boolean, default=False)
123
+ rating = db.Column(db.Float, default=0)
124
+ reviews = db.Column(db.Integer, default=0)
125
+ date_added = db.Column(db.DateTime, default=datetime.utcnow)
126
+ order_items = db.relationship('OrderItem', backref='product', lazy=True)
127
+
128
+ class Order(db.Model):
129
+ id = db.Column(db.Integer, primary_key=True)
130
+ user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
131
+ total = db.Column(db.Float, nullable=False)
132
+ status = db.Column(db.String(20), default='Pending')
133
+ payment_method = db.Column(db.String(50))
134
+ shipping_address = db.Column(db.Text)
135
+ billing_address = db.Column(db.Text)
136
+ date_ordered = db.Column(db.DateTime, default=datetime.utcnow)
137
+ items = db.relationship('OrderItem', backref='order', lazy=True)
138
+
139
+ class OrderItem(db.Model):
140
+ id = db.Column(db.Integer, primary_key=True)
141
+ order_id = db.Column(db.Integer, db.ForeignKey('order.id'), nullable=False)
142
+ product_id = db.Column(db.Integer, db.ForeignKey('product.id'), nullable=False)
143
+ quantity = db.Column(db.Integer, nullable=False)
144
+ price = db.Column(db.Float, nullable=False)
145
+ </pre>
146
+ </div>
147
+
148
+ <div class="section">
149
+ <h2>2. Flask Application</h2>
150
+
151
+ <p>Create <code>app.py</code>:</p>
152
+ <pre>
153
+ import os
154
+ from flask import Flask, render_template, request, redirect, url_for, flash, send_from_directory
155
+ from flask_sqlalchemy import SQLAlchemy
156
+ from flask_login import LoginManager, login_user, login_required, logout_user, current_user
157
+ from flask_admin import Admin
158
+ from flask_admin.contrib.sqla import ModelView
159
+ from werkzeug.utils import secure_filename
160
+ from models import db, User, Product, Order, OrderItem
161
+ from config import Config
162
+
163
+ app = Flask(__name__)
164
+ app.config.from_object(Config)
165
+
166
+ # Initialize extensions
167
+ db.init_app(app)
168
+ login_manager = LoginManager(app)
169
+ login_manager.login_view = 'login'
170
+
171
+ # Create upload folder if not exists
172
+ if not os.path.exists(app.config['UPLOAD_FOLDER']):
173
+ os.makedirs(app.config['UPLOAD_FOLDER'])
174
+
175
+ @login_manager.user_loader
176
+ def load_user(user_id):
177
+ return User.query.get(int(user_id))
178
+
179
+ # Admin setup
180
+ class AdminModelView(ModelView):
181
+ def is_accessible(self):
182
+ return current_user.is_authenticated and current_user.is_admin
183
+
184
+ def inaccessible_callback(self, name, **kwargs):
185
+ return redirect(url_for('login'))
186
+
187
+ admin = Admin(app, name='Admin Panel', template_mode='bootstrap3')
188
+ admin.add_view(AdminModelView(User, db.session))
189
+ admin.add_view(AdminModelView(Product, db.session))
190
+ admin.add_view(AdminModelView(Order, db.session))
191
+ admin.add_view(AdminModelView(OrderItem, db.session))
192
+
193
+ # Routes
194
+ @app.route('/')
195
+ def home():
196
+ return render_template('admin/index.html')
197
+
198
+ @app.route('/login', methods=['GET', 'POST'])
199
+ def login():
200
+ if request.method == 'POST':
201
+ email = request.form.get('email')
202
+ password = request.form.get('password')
203
+ user = User.query.filter_by(email=email).first()
204
+
205
+ if user and user.check_password(password):
206
+ login_user(user)
207
+ next_page = request.args.get('next')
208
+ return redirect(next_page or url_for('admin.index'))
209
+ else:
210
+ flash('Invalid email or password', 'danger')
211
+
212
+ return render_template('auth/login.html')
213
+
214
+ @app.route('/logout')
215
+ @login_required
216
+ def logout():
217
+ logout_user()
218
+ return redirect(url_for('login'))
219
+
220
+ # API Endpoints
221
+ @app.route('/api/products', methods=['GET'])
222
+ def get_products():
223
+ products = Product.query.all()
224
+ return {'products': [{
225
+ 'id': p.id,
226
+ 'name': p.name,
227
+ 'price': p.price,
228
+ 'original_price': p.original_price,
229
+ 'image': url_for('uploaded_file', filename=p.image) if p.image else None,
230
+ 'category': p.category,
231
+ 'flash_sale': ,
232
+ 'rating': p.rating,
233
+ 'reviews': p.reviews
234
+ } for p in products]}
235
+
236
+ @app.route('/api/orders', methods=['POST'])
237
+ def create_order():
238
+ data = request.get_json()
239
+
240
+ # In a real app, you would validate the data and process payment
241
+ order = Order(
242
+ user_id=data.get('user_id'),
243
+ total=data['total'],
244
+ payment_method=data.get('payment_method', 'Credit Card'),
245
+ shipping_address=data.get('shipping_address', ''),
246
+ billing_address=data.get('billing_address', '')
247
+ )
248
+
249
+ db.session.add(order)
250
+
251
+ for item in data['items']:
252
+ order_item = OrderItem(
253
+ order_id=order.id,
254
+ product_id=item['product_id'],
255
+ quantity=item['quantity'],
256
+ price=item['price']
257
+ )
258
+ db.session.add(order_item)
259
+
260
+ db.session.commit()
261
+
262
+ return {'success': True, 'order_id': order.id}
263
+
264
+ @app.route('/uploads/<filename>')
265
+ def uploaded_file(filename):
266
+ return send_from_directory(app.config['UPLOAD_FOLDER'], filename)
267
+
268
+ # Create admin user on first run
269
+ def create_admin_user():
270
+ admin_email = app.config['ADMIN_EMAIL']
271
+ admin_password = app.config['ADMIN_PASSWORD']
272
+
273
+ if not User.query.filter_by(email=admin_email).first():
274
+ admin_user = User(
275
+ username='admin',
276
+ email=admin_email,
277
+ is_admin=True
278
+ )
279
+ admin_user.set_password(admin_password)
280
+ db.session.add(admin_user)
281
+ db.session.commit()
282
+ print("Admin user created successfully!")
283
+
284
+ if __name__ == '__main__':
285
+ with app.app_context():
286
+ db.create_all()
287
+ create_admin_user()
288
+ app.run(debug=True)
289
+ </pre>
290
+ </div>
291
+
292
+ <div class="section">
293
+ <h2>3. Admin Panel Templates</h2>
294
+
295
+ <h3>Login Template (templates/auth/login.html)</h3>
296
+ <pre>
297
+ &lt;!DOCTYPE html&gt;
298
+ &lt;html&gt;
299
+ &lt;head&gt;
300
+ &lt;title&gt;Admin Login&lt;/title&gt;
301
+ &lt;link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"&gt;
302
+ &lt;/head&gt;
303
+ &lt;body&gt;
304
+ &lt;div class="container mt-5"&gt;
305
+ &lt;div class="row justify-content-center"&gt;
306
+ &lt;div class="col-md-6 col-lg-4"&gt;
307
+ &lt;div class="card shadow"&gt;
308
+ &lt;div class="card-body"&gt;
309
+ &lt;h3 class="card-title text-center mb-4"&gt;Admin Login&lt;/h3&gt;
310
+ {% with messages = get_flashed_messages(with_categories=true) %}
311
+ {% if messages %}
312
+ {% for category, message in messages %}
313
+ &lt;div class="alert alert-{{ category }}"&gt;{{ message }}&lt;/div&gt;
314
+ {% endfor %}
315
+ {% endif %}
316
+ {% endwith %}
317
+ &lt;form method="POST" action="{{ url_for('login') }}"&gt;
318
+ &lt;div class="mb-3"&gt;
319
+ &lt;label for="email" class="form-label"&gt;Email&lt;/label&gt;
320
+ &lt;input type="email" class="form-control" id="email" name="email" required&gt;
321
+ &lt;/div&gt;
322
+ &lt;div class="mb-3"&gt;
323
+ &lt;label for="password" class="form-label"&gt;Password&lt;/label&gt;
324
+ &lt;input type="password" class="form-control" id="password" name="password" required&gt;
325
+ &lt;/div&gt;
326
+ &lt;button type="submit" class="btn btn-primary w-100"&gt;Login&lt;/button&gt;
327
+ &lt;/form&gt;
328
+ &lt;/div&gt;
329
+ &lt;/div&gt;
330
+ &lt;/div&gt;
331
+ &lt;/div&gt;
332
+ &lt;/div&gt;
333
+ &lt;/body&gt;
334
+ &lt;/html&gt;
335
+ </pre>
336
+
337
+ <h3>Admin Dashboard (templates/admin/index.html)</h3>
338
+ <pre>
339
+ {% extends 'admin/master.html' %}
340
+
341
+ {% block body %}
342
+ &lt;div class="container"&gt;
343
+ &lt;h1&gt;Admin Dashboard&lt;/h1&gt;
344
+ &lt;div class="row mt-4"&gt;
345
+ &lt;div class="col-md-4"&gt;
346
+ &lt;div class="card text-white bg-primary mb-3"&gt;
347
+ &lt;div class="card-body"&gt;
348
+ &lt;h5 class="card-title"&gt;Total Products&lt;/h5&gt;
349
+ &lt;p class="card-text" style="font-size: 2rem;"&gt;{{ Product.query.count() }}&lt;/p&gt;
350
+ &lt;/div&gt;
351
+ &lt;/div&gt;
352
+ &lt;/div&gt;
353
+ &lt;div class="col-md-4"&gt;
354
+ &lt;div class="card text-white bg-success mb-3"&gt;
355
+ &lt;div class="card-body"&gt;
356
+ &lt;h5 class="card-title"&gt;Total Orders&lt;/h5&gt;
357
+ &lt;p class="card-text" style="font-size: 2rem;"&gt;{{ Order.query.count() }}&lt;/p&gt;
358
+ &lt;/div&gt;
359
+ &lt;/div&gt;
360
+ &lt;/div&gt;
361
+ &lt;div class="col-md-4"&gt;
362
+ &lt;div class="card text-white bg-info mb-3"&gt;
363
+ &lt;div class="card-body"&gt;
364
+ &lt;h5 class="card-title"&gt;Total Users&lt;/h5&gt;
365
+ &lt;p class="card-text" style="font-size: 2rem;"&gt;{{ User.query.count() }}&lt;/p&gt;
366
+ &lt;/div&gt;
367
+ &lt;/div&gt;
368
+ &lt;/div&gt;
369
+ &lt;/div&gt;
370
+
371
+ &lt;div class="row mt-4"&gt;
372
+ &lt;div class="col-md-6"&gt;
373
+ &lt;div class="card"&gt;
374
+ &lt;div class="card-header"&gt;
375
+ Recent Orders
376
+ &lt;/div&gt;
377
+ &lt;div class="card-body"&gt;
378
+ &lt;table class="table"&gt;
379
+ &lt;thead&gt;
380
+ &lt;tr&gt;
381
+ &lt;th&gt;ID&lt;/th&gt;
382
+ &lt;th&gt;Date&lt;/th&gt;
383
+ &lt;th&gt;Total&lt;/th&gt;
384
+ &lt;th&gt;Status&lt;/th&gt;
385
+ &lt;/tr&gt;
386
+ &lt;/thead&gt;
387
+ &lt;tbody&gt;
388
+ {% for order in Order.query.order_by(Order.date_ordered.desc()).limit(5).all() %}
389
+ &lt;tr&gt;
390
+ &lt;td&gt;&lt;a href="{{ url_for('order.edit_view', id=order.id) }}"&gt;{{ order.id }}&lt;/a&gt;&lt;/td&gt;
391
+ &lt;td&gt;{{ order.date_ordered.strftime('%Y-%m-%d') }}&lt;/td&gt;
392
+ &lt;td&gt;${{ "%.2f"|format(order.total) }}&lt;/td&gt;
393
+ &lt;td&gt;{{ order.status }}&lt;/td&gt;
394
+ &lt;/tr&gt;
395
+ {% endfor %}
396
+ &lt;/tbody&gt;
397
+ &lt;/table&gt;
398
+ &lt;/div&gt;
399
+ &lt;/div&gt;
400
+ &lt;/div&gt;
401
+ &lt;div class="col-md-6"&gt;
402
+ &lt;div class="card"&gt;
403
+ &lt;div class="card-header"&gt;
404
+ Recent Products
405
+ &lt;/div&gt;
406
+ &lt;div class="card-body"&gt;
407
+ &lt;table class="table"&gt;
408
+ &lt;thead&gt;
409
+ &lt;tr&gt;
410
+ &lt;th&gt;Name&lt;/th&gt;
411
+ &lt;th&gt;Price&lt;/th&gt;
412
+ &lt;th&gt;Category&lt;/th&gt;
413
+ &lt;/tr&gt;
414
+ &lt;/thead&gt;
415
+ &lt;tbody&gt;
416
+ {% for product in Product.query.order_by(Product.date_added.desc()).limit(5).all() %}
417
+ &lt;tr&gt;
418
+ &lt;td&gt;&lt;a href="{{ url_for('product.edit_view', id=product.id) }}"&gt;{{ product.name }}&lt;/a&gt;&lt;/td&gt;
419
+ &lt;td&gt;${{ "%.2f"|format(product.price) }}&lt;/td&gt;
420
+ &lt;td&gt;{{ product.category }}&lt;/td&gt;
421
+ &lt;/tr&gt;
422
+ {% endfor %}
423
+ &lt;/tbody&gt;
424
+ &lt;/table&gt;
425
+ &lt;/div&gt;
426
+ &lt;/div&gt;
427
+ &lt;/div&gt;
428
+ &lt;/div&gt;
429
+ &lt;/div&gt;
430
+ {% endblock %}
431
+ </pre>
432
+ </div>
433
+
434
+ <div class="section">
435
+ <h2>4. Integration with Frontend</h2>
436
+
437
+ <h3>Update your frontend JavaScript to use the API</h3>
438
+ <p>Modify your existing JavaScript to fetch products from the backend:</p>
439
+ <pre>
440
+ // Fetch products from backend
441
+ async function fetchProducts() {
442
+ try {
443
+ const response = await fetch('/api/products');
444
+ const data = await response.json();
445
+ return data.products;
446
+ } catch (error) {
447
+ console.error('Error fetching products:', error);
448
+ return [];
449
+ }
450
+ }
451
+
452
+ // Example of creating an order
453
+ async function createOrder(orderData) {
454
+ try {
455
+ const response = await fetch('/api/orders', {
456
+ method: 'POST',
457
+ headers: {
458
+ 'Content-Type': 'application/json',
459
+ },
460
+ body: JSON.stringify(orderData)
461
+ });
462
+ return await response.json();
463
+ } catch (error) {
464
+ console.error('Error creating order:', error);
465
+ return { success: false, error: 'Failed to create order' };
466
+ }
467
+ }
468
+
469
+ // Update your existing code to use these functions
470
+ document.addEventListener('DOMContentLoaded', async function() {
471
+ const products = await fetchProducts();
472
+ // Render products to the page
473
+ renderProducts(products);
474
+
475
+ // When user checks out
476
+ checkoutButton.addEventListener('click', async function() {
477
+ const orderData = {
478
+ user_id: currentUser?.id || null,
479
+ total: calculateCartTotal(),
480
+ items: cart.map(item => ({
481
+ product_id: item.id,
482
+ quantity: item.quantity,
483
+ price: item.price
484
+ })),
485
+ payment_method: 'Credit Card',
486
+ shipping_address: '123 Main St, Anytown, USA'
487
+ };
488
+
489
+ const result = await createOrder(orderData);
490
+ if (result.success) {
491
+ alert(`Order #${result.order_id} created successfully!`);
492
+ // Clear cart
493
+ cart = [];
494
+ localStorage.setItem('cart', JSON.stringify(cart));
495
+ updateCartCount();
496
+ renderCartItems();
497
+ } else {
498
+ alert('Failed to create order: ' + (result.error || 'Unknown error'));
499
+ }
500
+ });
501
+ });
502
+ </pre>
503
+ </div>
504
+
505
+ <div class="section">
506
+ <h2>5. Deployment Instructions</h2>
507
+
508
+ <div class="note">
509
+ <p><strong>Note:</strong> For production, you should use a proper web server like Gunicorn with Nginx, and a production database like PostgreSQL.</p>
510
+ </div>
511
+
512
+ <h3>Local Development</h3>
513
+ <ol>
514
+ <li>Install Python 3.8+</li>
515
+ <li>Create and activate a virtual environment:
516
+ <pre>python -m venv venv
517
+ source venv/bin/activate # On Windows: venv\Scripts\activate</pre>
518
+ </li>
519
+ <li>Install dependencies:
520
+ <pre>pip install -r requirements.txt</pre>
521
+ </li>
522
+ <li>Run the application:
523
+ <pre>python app.py</pre>
524
+ </li>
525
+ <li>Access the admin panel at <code>http://localhost:5000/admin</code></li>
526
+ <li>Login with the admin credentials from <code>config.py</code></li>
527
+ </ol>
528
+
529
+ <h3>Production Deployment</h3>
530
+ <p>For production, you'll need to:</p>
531
+ <ol>
532
+ <li>Set proper environment variables (SECRET_KEY, DATABASE_URL, etc.)</li>
533
+ <li>Use a production WSGI server like Gunicorn:
534
+ <pre>gunicorn -w 4 -b 0.0.0.0:5000 app:app</pre>
535
+ </li>
536
+ <li>Configure a reverse proxy like Nginx</li>
537
+ <li>Set up a production database (PostgreSQL recommended)</li>
538
+ <li>Configure HTTPS with Let's Encrypt</li>
539
+ </ol>
540
+ </div>
541
+ </div>
542
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Marv12/sma" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
543
+ </html>
prompts.txt ADDED
File without changes