add apps and drf_yasg
This commit is contained in:
32
config/conf/drf_yasg.py
Normal file
32
config/conf/drf_yasg.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
from rest_framework import permissions
|
||||||
|
from drf_yasg.views import get_schema_view
|
||||||
|
from drf_yasg import openapi
|
||||||
|
|
||||||
|
|
||||||
|
schema_view = get_schema_view(
|
||||||
|
openapi.Info(
|
||||||
|
title="UyQur API",
|
||||||
|
default_version='v1',
|
||||||
|
description="Test description",
|
||||||
|
terms_of_service="https://www.google.com/policies/terms/",
|
||||||
|
contact=openapi.Contact(email="xoliqberdiyevbehru12@gmail.com"),
|
||||||
|
license=openapi.License(name="Felix IT Solutions License"),
|
||||||
|
),
|
||||||
|
public=False,
|
||||||
|
permission_classes=(permissions.IsAuthenticated,),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
SWAGGER_SETTINGS = {
|
||||||
|
'SECURITY_DEFINITIONS': {
|
||||||
|
'Basic': {
|
||||||
|
'type': 'basic'
|
||||||
|
},
|
||||||
|
'Bearer': {
|
||||||
|
'type': 'apiKey',
|
||||||
|
'name': 'Authorization',
|
||||||
|
'in': 'header'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"USE_SESSION_AUTH": False
|
||||||
|
}
|
||||||
@@ -19,8 +19,16 @@ ALLOWED_HOSTS = env.list('ALLOWED_HOSTS')
|
|||||||
|
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
APPS = [
|
||||||
|
'core.apps.accounts',
|
||||||
|
'core.apps.shared',
|
||||||
|
]
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
PACKAGES = [
|
||||||
|
'drf_yasg',
|
||||||
|
]
|
||||||
|
|
||||||
|
DJANGO_APPS = [
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
@@ -29,6 +37,12 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
INSTALLED_APPS = []
|
||||||
|
INSTALLED_APPS += DJANGO_APPS
|
||||||
|
INSTALLED_APPS += PACKAGES
|
||||||
|
INSTALLED_APPS += APPS
|
||||||
|
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
|||||||
@@ -1,22 +1,29 @@
|
|||||||
"""
|
|
||||||
URL configuration for config project.
|
|
||||||
|
|
||||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
|
||||||
https://docs.djangoproject.com/en/5.2/topics/http/urls/
|
|
||||||
Examples:
|
|
||||||
Function views
|
|
||||||
1. Add an import: from my_app import views
|
|
||||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
|
||||||
Class-based views
|
|
||||||
1. Add an import: from other_app.views import Home
|
|
||||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
|
||||||
Including another URLconf
|
|
||||||
1. Import the include() function: from django.urls import include, path
|
|
||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
|
||||||
"""
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path
|
from django.urls import path, include
|
||||||
|
from django.conf import settings
|
||||||
|
from django.conf.urls.static import static
|
||||||
|
|
||||||
|
from config.conf.drf_yasg import schema_view
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
# Admin Panel
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
|
|
||||||
|
# Api V1
|
||||||
|
path('api/v1/', include(
|
||||||
|
[
|
||||||
|
path('accounts/', include('core.apps.accounts.urls')),
|
||||||
|
path('shared/', include('core.apps.shared.urls')),
|
||||||
|
]
|
||||||
|
)),
|
||||||
|
|
||||||
|
# Swagger and Redoc
|
||||||
|
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'),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Media and Static Files
|
||||||
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||||
|
|||||||
0
core/apps/accounts/__init__.py
Normal file
0
core/apps/accounts/__init__.py
Normal file
0
core/apps/accounts/admin/__init__.py
Normal file
0
core/apps/accounts/admin/__init__.py
Normal file
6
core/apps/accounts/apps.py
Normal file
6
core/apps/accounts/apps.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class AccountsConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'core.apps.accounts'
|
||||||
0
core/apps/accounts/managers/__init__.py
Normal file
0
core/apps/accounts/managers/__init__.py
Normal file
0
core/apps/accounts/migrations/__init__.py
Normal file
0
core/apps/accounts/migrations/__init__.py
Normal file
0
core/apps/accounts/models/__init__.py
Normal file
0
core/apps/accounts/models/__init__.py
Normal file
0
core/apps/accounts/permissions/__init__.py
Normal file
0
core/apps/accounts/permissions/__init__.py
Normal file
0
core/apps/accounts/serializers/__init__.py
Normal file
0
core/apps/accounts/serializers/__init__.py
Normal file
0
core/apps/accounts/signals/__init__.py
Normal file
0
core/apps/accounts/signals/__init__.py
Normal file
0
core/apps/accounts/tasks/__init__.py
Normal file
0
core/apps/accounts/tasks/__init__.py
Normal file
0
core/apps/accounts/tests/__init__.py
Normal file
0
core/apps/accounts/tests/__init__.py
Normal file
6
core/apps/accounts/urls.py
Normal file
6
core/apps/accounts/urls.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
|
||||||
|
]
|
||||||
0
core/apps/accounts/views/__init__.py
Normal file
0
core/apps/accounts/views/__init__.py
Normal file
0
core/apps/shared/__init__.py
Normal file
0
core/apps/shared/__init__.py
Normal file
0
core/apps/shared/admin/__init__.py
Normal file
0
core/apps/shared/admin/__init__.py
Normal file
6
core/apps/shared/apps.py
Normal file
6
core/apps/shared/apps.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class SharedConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'core.apps.shared'
|
||||||
0
core/apps/shared/migrations/__init__.py
Normal file
0
core/apps/shared/migrations/__init__.py
Normal file
0
core/apps/shared/models/__init__.py
Normal file
0
core/apps/shared/models/__init__.py
Normal file
0
core/apps/shared/serializers/__init__.py
Normal file
0
core/apps/shared/serializers/__init__.py
Normal file
0
core/apps/shared/signals/__init__.py
Normal file
0
core/apps/shared/signals/__init__.py
Normal file
0
core/apps/shared/tasks/__init__.py
Normal file
0
core/apps/shared/tasks/__init__.py
Normal file
0
core/apps/shared/tests/__init__.py
Normal file
0
core/apps/shared/tests/__init__.py
Normal file
5
core/apps/shared/urls.py
Normal file
5
core/apps/shared/urls.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
]
|
||||||
0
core/apps/shared/views/__init__.py
Normal file
0
core/apps/shared/views/__init__.py
Normal file
@@ -2,9 +2,15 @@ asgiref==3.9.1
|
|||||||
click==8.2.1
|
click==8.2.1
|
||||||
Django==5.2.4
|
Django==5.2.4
|
||||||
django-environ==0.12.0
|
django-environ==0.12.0
|
||||||
|
djangorestframework==3.16.0
|
||||||
|
drf-yasg==1.21.10
|
||||||
gunicorn==23.0.0
|
gunicorn==23.0.0
|
||||||
h11==0.16.0
|
h11==0.16.0
|
||||||
|
inflection==0.5.1
|
||||||
packaging==25.0
|
packaging==25.0
|
||||||
psycopg2-binary==2.9.10
|
psycopg2-binary==2.9.10
|
||||||
|
pytz==2025.2
|
||||||
|
PyYAML==6.0.2
|
||||||
sqlparse==0.5.3
|
sqlparse==0.5.3
|
||||||
|
uritemplate==4.2.0
|
||||||
uvicorn==0.35.0
|
uvicorn==0.35.0
|
||||||
|
|||||||
@@ -41,11 +41,11 @@ http {
|
|||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /static/ {
|
location /resources/static/ {
|
||||||
alias /usr/share/nginx/html/resources/staticfiles/;
|
alias /usr/share/nginx/html/resources/staticfiles/;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /media/ {
|
location /resources/media/ {
|
||||||
alias /usr/share/nginx/html/resources/media/;
|
alias /usr/share/nginx/html/resources/media/;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user