Spaces:
Sleeping
Sleeping
Upload 119 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- api/__pycache__/__init__.cpython-312.pyc +0 -0
- api/__pycache__/__init__.cpython-313.pyc +0 -0
- api/__pycache__/urls.cpython-312.pyc +0 -0
- api/__pycache__/urls.cpython-313.pyc +0 -0
- api/__pycache__/views.cpython-312.pyc +0 -0
- api/__pycache__/views.cpython-313.pyc +0 -0
- api/urls.py +2 -0
- api/views.py +50 -7
- authentication/__pycache__/__init__.cpython-312.pyc +0 -0
- authentication/__pycache__/__init__.cpython-313.pyc +0 -0
- authentication/__pycache__/admin.cpython-312.pyc +0 -0
- authentication/__pycache__/admin.cpython-313.pyc +0 -0
- authentication/__pycache__/apps.cpython-312.pyc +0 -0
- authentication/__pycache__/apps.cpython-313.pyc +0 -0
- authentication/__pycache__/models.cpython-312.pyc +0 -0
- authentication/__pycache__/models.cpython-313.pyc +0 -0
- authentication/__pycache__/urls.cpython-312.pyc +0 -0
- authentication/__pycache__/urls.cpython-313.pyc +0 -0
- authentication/__pycache__/views.cpython-312.pyc +0 -0
- authentication/__pycache__/views.cpython-313.pyc +0 -0
- authentication/migrations/__pycache__/0001_initial.cpython-312.pyc +0 -0
- authentication/migrations/__pycache__/0001_initial.cpython-313.pyc +0 -0
- authentication/migrations/__pycache__/0002_alter_userdata_coupons_alter_userdata_otp.cpython-312.pyc +0 -0
- authentication/migrations/__pycache__/0002_alter_userdata_coupons_alter_userdata_otp.cpython-313.pyc +0 -0
- authentication/migrations/__pycache__/0003_alter_coupon_expirydate.cpython-312.pyc +0 -0
- authentication/migrations/__pycache__/0003_alter_coupon_expirydate.cpython-313.pyc +0 -0
- authentication/migrations/__pycache__/0004_coupon_discription.cpython-312.pyc +0 -0
- authentication/migrations/__pycache__/0004_coupon_discription.cpython-313.pyc +0 -0
- authentication/migrations/__pycache__/0005_userdata_refcode.cpython-312.pyc +0 -0
- authentication/migrations/__pycache__/0005_userdata_refcode.cpython-313.pyc +0 -0
- authentication/migrations/__pycache__/0006_userdata_activatedcoupons.cpython-312.pyc +0 -0
- authentication/migrations/__pycache__/0006_userdata_activatedcoupons.cpython-313.pyc +0 -0
- authentication/migrations/__pycache__/0007_userdata_revelid.cpython-312.pyc +0 -0
- authentication/migrations/__pycache__/0007_userdata_revelid.cpython-313.pyc +0 -0
- authentication/migrations/__pycache__/0008_alter_userdata_pincode.cpython-312.pyc +0 -0
- authentication/migrations/__pycache__/0008_alter_userdata_pincode.cpython-313.pyc +0 -0
- authentication/migrations/__pycache__/__init__.cpython-312.pyc +0 -0
- authentication/migrations/__pycache__/__init__.cpython-313.pyc +0 -0
- oneOone/__pycache__/__init__.cpython-312.pyc +0 -0
- oneOone/__pycache__/__init__.cpython-313.pyc +0 -0
- oneOone/__pycache__/settings.cpython-312.pyc +0 -0
- oneOone/__pycache__/settings.cpython-313.pyc +0 -0
- oneOone/__pycache__/urls.cpython-312.pyc +0 -0
- oneOone/__pycache__/urls.cpython-313.pyc +0 -0
- oneOone/__pycache__/wsgi.cpython-312.pyc +0 -0
- oneOone/__pycache__/wsgi.cpython-313.pyc +0 -0
- oneOone/settings.py +32 -53
- oneOone/urls.py +1 -0
- routers/__pycache__/db_routers.cpython-312.pyc +0 -0
- routers/db_routers.py +33 -0
api/__pycache__/__init__.cpython-312.pyc
ADDED
Binary file (148 Bytes). View file
|
|
api/__pycache__/__init__.cpython-313.pyc
ADDED
Binary file (133 Bytes). View file
|
|
api/__pycache__/urls.cpython-312.pyc
ADDED
Binary file (1.23 kB). View file
|
|
api/__pycache__/urls.cpython-313.pyc
ADDED
Binary file (1.17 kB). View file
|
|
api/__pycache__/views.cpython-312.pyc
ADDED
Binary file (11.5 kB). View file
|
|
api/__pycache__/views.cpython-313.pyc
ADDED
Binary file (11.3 kB). View file
|
|
api/urls.py
CHANGED
@@ -9,4 +9,6 @@ urlpatterns = [
|
|
9 |
path('product-category', product_category, name='product_category'),
|
10 |
path('coupon-list', CouponListView.as_view(), name='coupon_List'),
|
11 |
path('coupon-redeem', CouponRedeemView.as_view(), name='coupon_redeem'),
|
|
|
|
|
12 |
]
|
|
|
9 |
path('product-category', product_category, name='product_category'),
|
10 |
path('coupon-list', CouponListView.as_view(), name='coupon_List'),
|
11 |
path('coupon-redeem', CouponRedeemView.as_view(), name='coupon_redeem'),
|
12 |
+
path('product-list', ProductListView.as_view(), name='product_List'),
|
13 |
+
path('best-sellers', BestSellersView.as_view(), name='best_sellers'),
|
14 |
]
|
api/views.py
CHANGED
@@ -12,8 +12,9 @@ from io import BytesIO
|
|
12 |
from PIL import Image, ImageDraw
|
13 |
from barcode import Code128
|
14 |
|
15 |
-
authToken = '
|
16 |
-
|
|
|
17 |
|
18 |
def create_barcode_from_binary(binary_text, height=100, line_width=2):
|
19 |
"""
|
@@ -52,7 +53,7 @@ def create_barcode_from_binary(binary_text, height=100, line_width=2):
|
|
52 |
class HomeView(APIView):
|
53 |
def get(self, request):
|
54 |
message = "Welcome at home!"
|
55 |
-
return
|
56 |
|
57 |
class BarCodeView(APIView):
|
58 |
def get(self, request,code):
|
@@ -73,13 +74,13 @@ class EstablishmentListView(APIView):
|
|
73 |
global authToken
|
74 |
|
75 |
def get(self, request):
|
76 |
-
url = "
|
77 |
headers = {
|
78 |
'API-AUTHENTICATION': authToken
|
79 |
}
|
80 |
response = requests.get(url, headers=headers)
|
81 |
data = response.json().get("objects", [])
|
82 |
-
urlBase = "
|
83 |
|
84 |
for i in range(len(data)):
|
85 |
try:
|
@@ -96,7 +97,7 @@ class EstablishmentListView(APIView):
|
|
96 |
|
97 |
|
98 |
def resources_forward(request, resource_name,image_id):
|
99 |
-
url = "
|
100 |
headers = {
|
101 |
'API-AUTHENTICATION': authToken
|
102 |
}
|
@@ -107,7 +108,7 @@ def resources_forward(request, resource_name,image_id):
|
|
107 |
|
108 |
def product_category(request):
|
109 |
global authToken
|
110 |
-
url = "
|
111 |
headers = {
|
112 |
'API-AUTHENTICATION': authToken
|
113 |
}
|
@@ -115,6 +116,48 @@ def product_category(request):
|
|
115 |
data = response.json()["objects"]
|
116 |
return JsonResponse({"data": data})
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
class CouponListView(APIView):
|
120 |
permission_classes = [IsAuthenticated]
|
|
|
12 |
from PIL import Image, ImageDraw
|
13 |
from barcode import Code128
|
14 |
|
15 |
+
authToken = '54bef1bd2916433d8f1d821a8822c377:b0be3750efa7486288df03b53076b3c59d710d9f85a34f1a9594d08dda4c4b61'
|
16 |
+
RevelUrl = "https://101smokeshop.revelup.com"
|
17 |
+
wooCommerceAuth = "consumer_key=ck_be3c4f80816fa3750154af5c100ad03e450b10b1&consumer_secret=cs_c513ff4e21e426234ca7b2b589c6a88a3749dee2"
|
18 |
|
19 |
def create_barcode_from_binary(binary_text, height=100, line_width=2):
|
20 |
"""
|
|
|
53 |
class HomeView(APIView):
|
54 |
def get(self, request):
|
55 |
message = "Welcome at home!"
|
56 |
+
return JsonResponse({'message': message})
|
57 |
|
58 |
class BarCodeView(APIView):
|
59 |
def get(self, request,code):
|
|
|
74 |
global authToken
|
75 |
|
76 |
def get(self, request):
|
77 |
+
url = RevelUrl + "/enterprise/Establishment/?order_by=id&limit=10&offset=0"
|
78 |
headers = {
|
79 |
'API-AUTHENTICATION': authToken
|
80 |
}
|
81 |
response = requests.get(url, headers=headers)
|
82 |
data = response.json().get("objects", [])
|
83 |
+
urlBase = RevelUrl + ""
|
84 |
|
85 |
for i in range(len(data)):
|
86 |
try:
|
|
|
97 |
|
98 |
|
99 |
def resources_forward(request, resource_name,image_id):
|
100 |
+
url = RevelUrl + "/resources/"+resource_name+"/"+image_id
|
101 |
headers = {
|
102 |
'API-AUTHENTICATION': authToken
|
103 |
}
|
|
|
108 |
|
109 |
def product_category(request):
|
110 |
global authToken
|
111 |
+
url = RevelUrl + "/products/ProductCategory/"
|
112 |
headers = {
|
113 |
'API-AUTHENTICATION': authToken
|
114 |
}
|
|
|
116 |
data = response.json()["objects"]
|
117 |
return JsonResponse({"data": data})
|
118 |
|
119 |
+
class ProductListView(APIView):
|
120 |
+
permission_classes = [IsAuthenticated]
|
121 |
+
def get(self, request):
|
122 |
+
url = "https://101smokeshop.com/wp-json/wc/v3/products?"+wooCommerceAuth+"&orderby=popularity"
|
123 |
+
|
124 |
+
response = requests.request("GET", url)
|
125 |
+
try:
|
126 |
+
data = response.json()
|
127 |
+
productData = []
|
128 |
+
for product in data:
|
129 |
+
temp={
|
130 |
+
"id": product["id"],
|
131 |
+
"name": product["name"],
|
132 |
+
"image": product["images"][0]["src"],
|
133 |
+
"link": product["permalink"]
|
134 |
+
}
|
135 |
+
productData.append(temp)
|
136 |
+
return JsonResponse({"data": productData})
|
137 |
+
except json.JSONDecodeError:
|
138 |
+
print(response.text)
|
139 |
+
|
140 |
+
class BestSellersView(APIView):
|
141 |
+
permission_classes = [IsAuthenticated]
|
142 |
+
def get(self, request):
|
143 |
+
url = "https://101smokeshop.com/wp-json/wc/v3/products?"+wooCommerceAuth+"&orderby=menu_order"
|
144 |
+
|
145 |
+
response = requests.request("GET", url)
|
146 |
+
try:
|
147 |
+
data = response.json()
|
148 |
+
best_sellers = []
|
149 |
+
for product in data:
|
150 |
+
temp={
|
151 |
+
"id": product["id"],
|
152 |
+
"name": product["name"],
|
153 |
+
"image": product["images"][0]["src"],
|
154 |
+
"link": product["permalink"],
|
155 |
+
"price": product["price"] if product["price"] else product["regular_price"] if product["regular_price"] else product["sale_price"] if product["sale_price"] else 0
|
156 |
+
}
|
157 |
+
best_sellers.append(temp)
|
158 |
+
return JsonResponse({"data": best_sellers})
|
159 |
+
except json.JSONDecodeError:
|
160 |
+
print(response.text)
|
161 |
|
162 |
class CouponListView(APIView):
|
163 |
permission_classes = [IsAuthenticated]
|
authentication/__pycache__/__init__.cpython-312.pyc
ADDED
Binary file (159 Bytes). View file
|
|
authentication/__pycache__/__init__.cpython-313.pyc
ADDED
Binary file (144 Bytes). View file
|
|
authentication/__pycache__/admin.cpython-312.pyc
ADDED
Binary file (999 Bytes). View file
|
|
authentication/__pycache__/admin.cpython-313.pyc
ADDED
Binary file (1.06 kB). View file
|
|
authentication/__pycache__/apps.cpython-312.pyc
ADDED
Binary file (481 Bytes). View file
|
|
authentication/__pycache__/apps.cpython-313.pyc
ADDED
Binary file (524 Bytes). View file
|
|
authentication/__pycache__/models.cpython-312.pyc
ADDED
Binary file (5.07 kB). View file
|
|
authentication/__pycache__/models.cpython-313.pyc
ADDED
Binary file (4.89 kB). View file
|
|
authentication/__pycache__/urls.cpython-312.pyc
ADDED
Binary file (1.22 kB). View file
|
|
authentication/__pycache__/urls.cpython-313.pyc
ADDED
Binary file (1.16 kB). View file
|
|
authentication/__pycache__/views.cpython-312.pyc
ADDED
Binary file (20.8 kB). View file
|
|
authentication/__pycache__/views.cpython-313.pyc
ADDED
Binary file (20.9 kB). View file
|
|
authentication/migrations/__pycache__/0001_initial.cpython-312.pyc
ADDED
Binary file (4.53 kB). View file
|
|
authentication/migrations/__pycache__/0001_initial.cpython-313.pyc
ADDED
Binary file (4.32 kB). View file
|
|
authentication/migrations/__pycache__/0002_alter_userdata_coupons_alter_userdata_otp.cpython-312.pyc
ADDED
Binary file (972 Bytes). View file
|
|
authentication/migrations/__pycache__/0002_alter_userdata_coupons_alter_userdata_otp.cpython-313.pyc
ADDED
Binary file (983 Bytes). View file
|
|
authentication/migrations/__pycache__/0003_alter_coupon_expirydate.cpython-312.pyc
ADDED
Binary file (794 Bytes). View file
|
|
authentication/migrations/__pycache__/0003_alter_coupon_expirydate.cpython-313.pyc
ADDED
Binary file (821 Bytes). View file
|
|
authentication/migrations/__pycache__/0004_coupon_discription.cpython-312.pyc
ADDED
Binary file (759 Bytes). View file
|
|
authentication/migrations/__pycache__/0004_coupon_discription.cpython-313.pyc
ADDED
Binary file (786 Bytes). View file
|
|
authentication/migrations/__pycache__/0005_userdata_refcode.cpython-312.pyc
ADDED
Binary file (771 Bytes). View file
|
|
authentication/migrations/__pycache__/0005_userdata_refcode.cpython-313.pyc
ADDED
Binary file (798 Bytes). View file
|
|
authentication/migrations/__pycache__/0006_userdata_activatedcoupons.cpython-312.pyc
ADDED
Binary file (823 Bytes). View file
|
|
authentication/migrations/__pycache__/0006_userdata_activatedcoupons.cpython-313.pyc
ADDED
Binary file (850 Bytes). View file
|
|
authentication/migrations/__pycache__/0007_userdata_revelid.cpython-312.pyc
ADDED
Binary file (780 Bytes). View file
|
|
authentication/migrations/__pycache__/0007_userdata_revelid.cpython-313.pyc
ADDED
Binary file (807 Bytes). View file
|
|
authentication/migrations/__pycache__/0008_alter_userdata_pincode.cpython-312.pyc
ADDED
Binary file (764 Bytes). View file
|
|
authentication/migrations/__pycache__/0008_alter_userdata_pincode.cpython-313.pyc
ADDED
Binary file (791 Bytes). View file
|
|
authentication/migrations/__pycache__/__init__.cpython-312.pyc
ADDED
Binary file (170 Bytes). View file
|
|
authentication/migrations/__pycache__/__init__.cpython-313.pyc
ADDED
Binary file (155 Bytes). View file
|
|
oneOone/__pycache__/__init__.cpython-312.pyc
ADDED
Binary file (152 Bytes). View file
|
|
oneOone/__pycache__/__init__.cpython-313.pyc
ADDED
Binary file (137 Bytes). View file
|
|
oneOone/__pycache__/settings.cpython-312.pyc
ADDED
Binary file (4.17 kB). View file
|
|
oneOone/__pycache__/settings.cpython-313.pyc
ADDED
Binary file (3.74 kB). View file
|
|
oneOone/__pycache__/urls.cpython-312.pyc
ADDED
Binary file (722 Bytes). View file
|
|
oneOone/__pycache__/urls.cpython-313.pyc
ADDED
Binary file (626 Bytes). View file
|
|
oneOone/__pycache__/wsgi.cpython-312.pyc
ADDED
Binary file (640 Bytes). View file
|
|
oneOone/__pycache__/wsgi.cpython-313.pyc
ADDED
Binary file (625 Bytes). View file
|
|
oneOone/settings.py
CHANGED
@@ -26,42 +26,13 @@ SECRET_KEY = "django-insecure-8&2s2s)--3hof($4+pkt0@$l1tz8so+$t=%yq9y0on=s$2_^$p
|
|
26 |
# SECURITY WARNING: don't run with debug turned on in production!
|
27 |
DEBUG = True
|
28 |
|
29 |
-
ALLOWED_HOSTS = ["*", "127.0.0.1", "192.168.81.1", "192.168.12.61", "thejagstudio-101.hf.space"]
|
30 |
-
CORS_ALLOWED_ORIGINS = [
|
31 |
-
|
32 |
-
"http://localhost:19006",
|
33 |
-
"http://192.168.81.1:8000",
|
34 |
-
"http://192.168.12.61:8000",
|
35 |
-
"https://s4t6xdgk-8000.inc1.devtunnels.ms",
|
36 |
-
"http://thejagstudio-101.hf.space",
|
37 |
-
"https://thejagstudio-101.hf.space"
|
38 |
-
]
|
39 |
-
CSRF_TRUSTED_ORIGINS = [
|
40 |
-
"http://localhost:8081",
|
41 |
-
"http://192.168.81.1:8000",
|
42 |
-
"http://192.168.12.61:8000",
|
43 |
-
"http://localhost:19006",
|
44 |
-
"https://s4t6xdgk-8000.inc1.devtunnels.ms",
|
45 |
-
"http://thejagstudio-101.hf.space",
|
46 |
-
"https://thejagstudio-101.hf.space"
|
47 |
-
]
|
48 |
|
49 |
# Application definition
|
50 |
|
51 |
-
INSTALLED_APPS = [
|
52 |
-
"django.contrib.admin",
|
53 |
-
"django.contrib.auth",
|
54 |
-
"django.contrib.contenttypes",
|
55 |
-
"django.contrib.sessions",
|
56 |
-
"django.contrib.messages",
|
57 |
-
"django.contrib.staticfiles",
|
58 |
-
"rest_framework",
|
59 |
-
"rest_framework_simplejwt",
|
60 |
-
"rest_framework_simplejwt.token_blacklist",
|
61 |
-
"import_export",
|
62 |
-
"corsheaders",
|
63 |
-
"authentication"
|
64 |
-
]
|
65 |
|
66 |
MIDDLEWARE = [
|
67 |
"django.middleware.security.SecurityMiddleware",
|
@@ -99,15 +70,27 @@ WSGI_APPLICATION = "oneOone.wsgi.application"
|
|
99 |
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
100 |
|
101 |
DATABASES = {
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
}
|
|
|
111 |
# "default": {
|
112 |
# "ENGINE": "django.db.backends.sqlite3",
|
113 |
# "NAME": BASE_DIR / "db.sqlite3",
|
@@ -156,21 +139,17 @@ STATIC_URL = "static/"
|
|
156 |
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
157 |
|
158 |
REST_FRAMEWORK = {
|
159 |
-
|
160 |
-
|
161 |
-
),
|
162 |
-
'DEFAULT_PERMISSION_CLASSES': (
|
163 |
-
'rest_framework.permissions.AllowAny',
|
164 |
-
),
|
165 |
}
|
166 |
|
167 |
|
168 |
SIMPLE_JWT = {
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
}
|
175 |
|
176 |
-
EMAIL_BACKEND =
|
|
|
26 |
# SECURITY WARNING: don't run with debug turned on in production!
|
27 |
DEBUG = True
|
28 |
|
29 |
+
ALLOWED_HOSTS = ["*", "127.0.0.1", "192.168.81.1", "192.168.12.61", "thejagstudio-101.hf.space", "10.0.0.227"]
|
30 |
+
CORS_ALLOWED_ORIGINS = ["http://localhost:8081", "http://localhost:19006", "http://192.168.81.1:8000", "http://10.0.0.227:8000", "http://192.168.12.61:8000", "https://s4t6xdgk-8000.inc1.devtunnels.ms", "http://thejagstudio-101.hf.space", "https://thejagstudio-101.hf.space"]
|
31 |
+
CSRF_TRUSTED_ORIGINS = ["http://localhost:8081", "http://192.168.81.1:8000", "http://192.168.12.61:8000", "http://10.0.0.227:8000", "http://localhost:19006", "https://s4t6xdgk-8000.inc1.devtunnels.ms", "http://thejagstudio-101.hf.space", "https://thejagstudio-101.hf.space"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
# Application definition
|
34 |
|
35 |
+
INSTALLED_APPS = ["django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "rest_framework", "rest_framework_simplejwt", "rest_framework_simplejwt.token_blacklist", "import_export", "corsheaders", "authentication", "wordpress_api"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
MIDDLEWARE = [
|
38 |
"django.middleware.security.SecurityMiddleware",
|
|
|
70 |
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
71 |
|
72 |
DATABASES = {
|
73 |
+
"default": {
|
74 |
+
"ENGINE": "django.db.backends.postgresql",
|
75 |
+
"NAME": "postgres",
|
76 |
+
"USER": "postgres.igsosentooipcjyflmnw",
|
77 |
+
"PORT": 6543,
|
78 |
+
"PASSWORD": "bfHBTQr6xCAwdbts",
|
79 |
+
"HOST": "aws-0-us-east-1.pooler.supabase.com",
|
80 |
+
"OPTIONS": {
|
81 |
+
"gssencmode": "disable",
|
82 |
+
},
|
83 |
+
},
|
84 |
+
"woocommerce": {
|
85 |
+
"ENGINE": "django.db.backends.mysql",
|
86 |
+
"NAME": "hvyakryx_wp944",
|
87 |
+
"USER": "hvyakryx_appBestBeauty",
|
88 |
+
"PASSWORD": "C-H8_VD~jG9a",
|
89 |
+
"HOST": "216.137.176.112",
|
90 |
+
"PORT": "3306",
|
91 |
+
},
|
92 |
}
|
93 |
+
DATABASE_ROUTERS = ["routers.db_routers.AuthRouter", "routers.db_routers.WoocommerceRouter"]
|
94 |
# "default": {
|
95 |
# "ENGINE": "django.db.backends.sqlite3",
|
96 |
# "NAME": BASE_DIR / "db.sqlite3",
|
|
|
139 |
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
140 |
|
141 |
REST_FRAMEWORK = {
|
142 |
+
"DEFAULT_AUTHENTICATION_CLASSES": ("rest_framework_simplejwt.authentication.JWTAuthentication",),
|
143 |
+
"DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.AllowAny",),
|
|
|
|
|
|
|
|
|
144 |
}
|
145 |
|
146 |
|
147 |
SIMPLE_JWT = {
|
148 |
+
"ACCESS_TOKEN_LIFETIME": timedelta(days=60),
|
149 |
+
"REFRESH_TOKEN_LIFETIME": timedelta(days=60),
|
150 |
+
"ROTATE_REFRESH_TOKENS": True,
|
151 |
+
"BLACKLIST_AFTER_ROTATION": True,
|
152 |
+
"UPDATE_LAST_LOGIN": True,
|
153 |
}
|
154 |
|
155 |
+
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
oneOone/urls.py
CHANGED
@@ -8,4 +8,5 @@ urlpatterns = [
|
|
8 |
path('api-auth/', include('rest_framework.urls')),
|
9 |
path('api/auth/', include('authentication.urls')),
|
10 |
path('api/', include('api.urls')),
|
|
|
11 |
]
|
|
|
8 |
path('api-auth/', include('rest_framework.urls')),
|
9 |
path('api/auth/', include('authentication.urls')),
|
10 |
path('api/', include('api.urls')),
|
11 |
+
path('api/wordpress/', include('wordpress_api.urls')),
|
12 |
]
|
routers/__pycache__/db_routers.cpython-312.pyc
ADDED
Binary file (1.86 kB). View file
|
|
routers/db_routers.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class AuthRouter:
|
2 |
+
route_app_labels = {'auth', 'contenttypes', 'sessions', 'admin'}
|
3 |
+
|
4 |
+
def db_for_read(self, model, **hints):
|
5 |
+
if model._meta.app_label in self.route_app_labels:
|
6 |
+
return 'default'
|
7 |
+
return None
|
8 |
+
|
9 |
+
def db_for_write(self, model, **hints):
|
10 |
+
if model._meta.app_label in self.route_app_labels:
|
11 |
+
return 'default'
|
12 |
+
return None
|
13 |
+
|
14 |
+
def allow_relation(self, obj1, obj2, **hints):
|
15 |
+
if (
|
16 |
+
obj1._meta.app_label in self.route_app_labels or
|
17 |
+
obj2._meta.app_label in self.route_app_labels
|
18 |
+
):
|
19 |
+
return True
|
20 |
+
return None
|
21 |
+
|
22 |
+
def allow_migrate(self, db, app_label, model_name=None, **hints):
|
23 |
+
if app_label in self.route_app_labels:
|
24 |
+
return db == 'default'
|
25 |
+
return None
|
26 |
+
|
27 |
+
class WoocommerceRouter:
|
28 |
+
route_app_labels = {'woocommerce'}
|
29 |
+
|
30 |
+
def db_for_read(self, model, **hints):
|
31 |
+
if model._meta.app_label in self.route_app_labels:
|
32 |
+
return 'woocommerce'
|
33 |
+
return None
|