Skip to content

Commit

Permalink
refactor: Move some files to another directory
Browse files Browse the repository at this point in the history
  • Loading branch information
HamidRezaSZ committed Dec 22, 2024
1 parent 5d6f762 commit 5436f45
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 35 deletions.
File renamed without changes.
3 changes: 0 additions & 3 deletions base/tests.py

This file was deleted.

5 changes: 2 additions & 3 deletions core/channels_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, inner):
self.inner = inner

async def __call__(self, scope, receive, send):
# Close old database connections to prevent usage of timed out connections
# Close old database connections to prevent usage of timed out connections
close_old_connections()

# Get the token
Expand All @@ -44,8 +44,7 @@ async def __call__(self, scope, receive, send):
return None
else:
# Then token is valid, decode it
decoded_data = jwt_decode(
token, settings.SECRET_KEY, algorithms=["HS256"])
decoded_data = jwt_decode(token, settings.SECRET_KEY, algorithms=["HS256"])
# Will return a dictionary like -
# {
# "token_type": "access",
Expand Down
2 changes: 1 addition & 1 deletion core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
# Djagno Rest Framework
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'accounts.authentication.JWTAuthentication',
'accounts.utils.authentication.JWTAuthentication',
'rest_framework.authentication.SessionAuthentication',
),
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
Expand Down
55 changes: 27 additions & 28 deletions core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.urls import include, path, re_path
Expand All @@ -23,46 +24,44 @@
schema_view = get_schema_view(
openapi.Info(
title="Core API",
default_version='v1',
default_version="v1",
description="",
terms_of_service="https://www.google.com/policies/terms/",
contact=openapi.Contact(email="[email protected]"),
license=openapi.License(name="BSD License"),
),
url='',
url="",
public=True,
permission_classes=[permissions.AllowAny],
permission_classes=[permissions.IsAuthenticated],
)

urlpatterns = i18n_patterns(
# apps
path('api/blog/', include('blog.urls')),
path('api/accounts/', include('accounts.urls')),
path('api/base/', include('base.urls')),
path('api/products/', include('products.urls')),
path('api/payments/', include('payments.urls')),
path('api/cart/', include('cart.urls')),
path('api/exams/', include('exams.urls')),
path('api/newsletters/', include('newsletters.urls')),
path('api/orders/', include('orders.urls')),
path('api/ticketing/', include('ticketing.urls')),
path('api/courses/', include('courses.urls')),


path("api/v1/blog/", include("blog.urls")),
path("api/v1/accounts/", include("accounts.urls")),
path("api/v1/api/base/", include("base.urls")),
path("api/v1/api/products/", include("products.urls")),
path("api/v1/api/payments/", include("payments.urls")),
path("api/v1/api/cart/", include("cart.urls")),
path("api/v1/api/exams/", include("exams.urls")),
path("api/v1/api/newsletters/", include("newsletters.urls")),
path("api/v1/api/orders/", include("orders.urls")),
path("api/v1/api/ticketing/", include("ticketing.urls")),
path("api/v1/api/courses/", include("courses.urls")),
# rosetta (multiple language package)
re_path(r'^rosetta/', include('rosetta.urls')),

re_path(r"^rosetta/", include("rosetta.urls")),
# ckeditor (Text Editor)
re_path(r'^ckeditor/', include('ckeditor_uploader.urls')), # Text editor

re_path(r"^ckeditor/", include("ckeditor_uploader.urls")), # Text editor
# swgger
re_path(r'^swagger(?P<format>\.json|\.yaml)$',
schema_view.without_ui(cache_timeout=0), name='schema-json'),
re_path(r'^swagger/$', schema_view.with_ui('swagger',
cache_timeout=0), name='schema-swagger-ui'),
re_path(r'^redoc/$', schema_view.with_ui('redoc',
cache_timeout=0), name='schema-redoc'),

path(
"swagger<format>/", schema_view.without_ui(cache_timeout=0), name="schema-json"
),
path(
"swagger/",
schema_view.with_ui("swagger", cache_timeout=0),
name="schema-swagger-ui",
),
path("redoc/", schema_view.with_ui("redoc", cache_timeout=0), name="schema-redoc"),
# admin panel
path('', admin.site.urls),
path("", admin.site.urls),
)

0 comments on commit 5436f45

Please sign in to comment.