This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSTALLED_APPS = [ | |
| .... | |
| "‘drf_yasg’", | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| REST_FRAMEWORK = { | |
| 'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.URLPathVersioning' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| urlpatterns = [ | |
| path("admin/", admin.site.urls), | |
| re_path(r'api/(?P<version>[v1|v2]+)/', include('django_blog.apps.blog.rest_api.urls')), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSTALLED_APPS = [ | |
| .... | |
| # our apps | |
| "django_blog.apps.common.apps.CommonConfig", | |
| "django_blog.apps.account.apps.AccountConfig", | |
| "django_blog.apps.blog.apps.BlogConfig", | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DJANGO_BLOG_DATABASE_URL=sqlite:///db.sqlite3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DJANGO_BLOG_DATABASE_URL=psql://django_blog@127.0.0.1:5432/django_blog |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| django_blog | |
| ├── api | |
| │ ├── django_blog | |
| │ │ ├── apps | |
| │ │ │ ├── account | |
| │ │ │ │ ├── admin.py | |
| │ │ │ │ ├── apps.py | |
| │ │ │ │ ├── forms.py | |
| │ │ │ │ ├── __init__.py | |
| │ │ │ │ ├── managers.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from drf_yasg.views import get_schema_view | |
| from drf_yasg import openapi | |
| from rest_framework import permissions | |
| schema_view = get_schema_view( | |
| openapi.Info( | |
| title="Blog API", | |
| default_version='v1', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_serializer_class(self): | |
| if self.request.version == 'v2': | |
| return PostSerializerV2 | |
| else: | |
| return super().get_serializer_class() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Creating test database for alias 'default'... | |
| System check identified no issues (0 silenced). | |
| ....... | |
| ---------------------------------------------------------------------- | |
| Ran 7 tests in 0.036s | |
| OK | |
| Destroying test database for alias 'default'... |
NewerOlder