conf(production):structure setting of production server and app verion api

This commit is contained in:
bobbyvish
2024-05-21 19:02:26 +05:30
parent bbc01addda
commit 971f3f6c92
6 changed files with 16 additions and 22 deletions

View File

@@ -19,5 +19,6 @@ urlpatterns = [
path('apple-signin/', views.AppleSignin.as_view(), name='apple_signin'),
path('version-check/', views.VersionCheck.as_view(), name='version_check'),
path('app-version/', views.VersionCheck.as_view(), name='version_check'),
]

View File

@@ -374,14 +374,14 @@ class VersionCheck(APIView):
model = AppVersion
def get(self, request, *args, **kwargs):
app_version = request.GET.get('appVersion')
# app_version = request.GET.get('appVersion')
device_type = request.GET.get('deviceType')
if not app_version or not device_type:
if not device_type:
return ApiResponse.error(message=constants.FAILURE, errors="App version and device type is required")
# Query the database to retrieve the upgrade flags based on the app version
try:
version = self.model.objects.get(version=app_version)
version = self.model.objects.filter(device_type=device_type).last()
except self.model.DoesNotExist:
version = None

View File

@@ -449,10 +449,10 @@ class IAmPrincipalBiometric(BaseModel):
class AppVersion(models.Model):
DEVICE_CHOICES = [
('apple', 'apple'),
('ios', 'ios'),
('android', 'android'),
]
device_type = models.CharField(max_length=10, choices=DEVICE_CHOICES, verbose_name='Device Type (apple / android)')
device_type = models.CharField(max_length=10, choices=DEVICE_CHOICES, verbose_name='Device Type (ios / android)')
version = models.CharField(max_length=5, validators=[RegexValidator(r'^\d+\.\d+\.\d+$')], verbose_name='Version')
force_upgrade = models.BooleanField(default=False, verbose_name='Force Upgrade', help_text='Indicates whether a force upgrade is needed for this app version.')
recommend_upgrade = models.BooleanField(default=False, verbose_name='Recommend Upgrade', help_text='Indicates whether a recommend upgrade is needed for this app version.')

View File

@@ -4,19 +4,18 @@ import os
import colorlog
from logging.handlers import TimedRotatingFileHandler
DEBUG = False
ALLOWED_HOSTS = []
# DEBUG = True
ALLOWED_HOSTS = ["admin.eatwithdigest.com"]
# CORS_ALLOWED_ORIGINS = [
# # "http://127.0.0.1:3000",
# "http://127.0.0.1:3000",
# ]
# CORS_ORIGIN_ALLOW_ALL = True
CORS_ORIGIN_ALLOW_ALL = True
# CORS_ORIGIN_WHITELIST = ("",)
# CORS_ORIGIN_WHITELIST = ("http://localhost:3000",)
LOGGING_DIR = os.path.join(
@@ -29,7 +28,7 @@ if not os.path.exists(LOGGING_DIR):
LOGGING_LEVEL = env.str(
"LOG_LEVEL", "INFO"
) # Set your desired log level (e.g., DEBUG, INFO, WARNING, ERROR)
) # Set your desired log level (e.g., DEBUG, INFO, WARNING, ERROR) in the env file
LOGGING = {
@@ -70,8 +69,7 @@ LOGGING = {
},
}
BASE_DOMAIN = ""
BASE_DOMAIN = "https://admin.eatwithdigest.com"
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
@@ -80,8 +78,8 @@ BASE_DOMAIN = ""
MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
# STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATIC_URL = "/static/"
STATICFILES_DIRS = [BASE_DIR.joinpath("static")]
# STATICFILES_DIRS = [BASE_DIR.joinpath("static")]

View File

@@ -8,11 +8,6 @@ https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
"""
import os
import sys
sys.path.append('/var/www/testing_django/testing')
sys.path.append('/var/www/testing_django/testing/testing')
sys.path.append('/var/www/testing_django/testing/venv/lib/python3.11/site-packages')
from django.core.wsgi import get_wsgi_application

View File

@@ -56,7 +56,7 @@
<p><strong>Your Message:</strong></p>
<p>{{ message }}</p>
<p>We will respond to your inquiry as soon as possible.</p>
<p>In the meantime, you may find answers to frequently asked questions on our Help Center: <a href="#">[link to Help Center]</a></p>
<p>In the meantime, you may find answers to frequently asked questions on our Help Center: <a href="https://eatwithdigest.com">eatwithdigest.com</a></p>
<p>Sincerely,</p>
<p>The Digest Team</p>
</div>