diff --git a/.env.example b/.env.example index b501a15..60cf66f 100644 --- a/.env.example +++ b/.env.example @@ -1,13 +1,4 @@ -# README -# 1. No spaces before or after `=`. -# 2. Don't use quotations around strings, they're counted as strings by default. -# 3. Change values according to your environment. -# 4. Docker will automatically take all values from this file automatically. -# 5. If values exist in the environment, it will not take values from this file. -# 6. Rename this file from `.env.example` to `.env` - - -SECRET_KEY=django-insecure-$227hjjmuq2e!)o^@2v#+(-=@$v362o@8g#s9!2)tjn1)1a +SECRET_KEY=super-insecure-django-key DEBUG=True ALLOWED_HOSTS=* ENV_NAME=DEV diff --git a/apps/app_one/__init__.py b/apps/__init__.py similarity index 100% rename from apps/app_one/__init__.py rename to apps/__init__.py diff --git a/apps/app_two/admin.py b/apps/app_two/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/apps/app_two/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/apps/app_two/models.py b/apps/app_two/models.py deleted file mode 100644 index 71a8362..0000000 --- a/apps/app_two/models.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.db import models - -# Create your models here. diff --git a/apps/app_two/tests.py b/apps/app_two/tests.py deleted file mode 100644 index 7ce503c..0000000 --- a/apps/app_two/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/apps/app_two/views.py b/apps/app_two/views.py deleted file mode 100644 index 91ea44a..0000000 --- a/apps/app_two/views.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.shortcuts import render - -# Create your views here. diff --git a/apps/app_two/apps.py b/apps/core/apps.py similarity index 83% rename from apps/app_two/apps.py rename to apps/core/apps.py index 73ac591..8115ae6 100644 --- a/apps/app_two/apps.py +++ b/apps/core/apps.py @@ -3,4 +3,4 @@ from django.apps import AppConfig class CoreConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' - name = 'second_app' + name = 'core' diff --git a/apps/core/models.py b/apps/core/models.py index e69de29..4c94919 100644 --- a/apps/core/models.py +++ b/apps/core/models.py @@ -0,0 +1,51 @@ +import uuid + +from django.conf import settings +from django.db import models +from django.utils.translation import gettext_lazy as _ + +user_model = settings.AUTH_USER_MODEL + + +class BaseModel(models.Model): + uid = models.UUIDField( + verbose_name=_('UUID'), + unique=True, + default=uuid.uuid4, + editable=False + ) + + created_by = models.ForeignKey( + to=user_model, + verbose_name=_('Created by'), + null=True, + blank=True, + related_name='%(class)s_created', + on_delete=models.SET_NULL + ) + + created_at = models.DateTimeField( + verbose_name=_('Created at'), + auto_now_add=True, + editable=False, + db_index=True + ) + + updated_by = models.ForeignKey( + to=user_model, + verbose_name=_('Updated by'), + null=True, + blank=True, + related_name='%(class)s_updated', + on_delete=models.SET_NULL + ) + + updated_at = models.DateTimeField( + verbose_name=_('Updated at'), + auto_now=True, + null=True, + blank=True + ) + + class Meta: + abstract = True diff --git a/apps/app_one/api/urls.py b/apps/core/urls.py similarity index 100% rename from apps/app_one/api/urls.py rename to apps/core/urls.py diff --git a/apps/app_one/api/__init__.py b/apps/example_api/__init__.py similarity index 100% rename from apps/app_one/api/__init__.py rename to apps/example_api/__init__.py diff --git a/apps/app_one/api/v1/__init__.py b/apps/example_api/api/__init__.py similarity index 100% rename from apps/app_one/api/v1/__init__.py rename to apps/example_api/api/__init__.py diff --git a/apps/app_one/api/v1/urls.py b/apps/example_api/api/urls.py similarity index 100% rename from apps/app_one/api/v1/urls.py rename to apps/example_api/api/urls.py diff --git a/apps/app_one/api/v2/__init__.py b/apps/example_api/api/v1/__init__.py similarity index 100% rename from apps/app_one/api/v2/__init__.py rename to apps/example_api/api/v1/__init__.py diff --git a/apps/app_one/api/v1/serializers.py b/apps/example_api/api/v1/serializers.py similarity index 100% rename from apps/app_one/api/v1/serializers.py rename to apps/example_api/api/v1/serializers.py diff --git a/apps/app_one/api/v1/services.py b/apps/example_api/api/v1/services.py similarity index 100% rename from apps/app_one/api/v1/services.py rename to apps/example_api/api/v1/services.py diff --git a/apps/app_one/api/v1/tests.py b/apps/example_api/api/v1/tests.py similarity index 100% rename from apps/app_one/api/v1/tests.py rename to apps/example_api/api/v1/tests.py diff --git a/apps/app_one/api/v2/urls.py b/apps/example_api/api/v1/urls.py similarity index 100% rename from apps/app_one/api/v2/urls.py rename to apps/example_api/api/v1/urls.py diff --git a/apps/app_one/api/v1/views.py b/apps/example_api/api/v1/views.py similarity index 100% rename from apps/app_one/api/v1/views.py rename to apps/example_api/api/v1/views.py diff --git a/apps/app_one/management/__init__.py b/apps/example_api/api/v2/__init__.py similarity index 100% rename from apps/app_one/management/__init__.py rename to apps/example_api/api/v2/__init__.py diff --git a/apps/app_one/api/v2/serializers.py b/apps/example_api/api/v2/serializers.py similarity index 100% rename from apps/app_one/api/v2/serializers.py rename to apps/example_api/api/v2/serializers.py diff --git a/apps/app_one/api/v2/services.py b/apps/example_api/api/v2/services.py similarity index 100% rename from apps/app_one/api/v2/services.py rename to apps/example_api/api/v2/services.py diff --git a/apps/app_one/api/v2/tests.py b/apps/example_api/api/v2/tests.py similarity index 100% rename from apps/app_one/api/v2/tests.py rename to apps/example_api/api/v2/tests.py diff --git a/apps/app_one/urls.py b/apps/example_api/api/v2/urls.py similarity index 100% rename from apps/app_one/urls.py rename to apps/example_api/api/v2/urls.py diff --git a/apps/app_one/api/v2/views.py b/apps/example_api/api/v2/views.py similarity index 100% rename from apps/app_one/api/v2/views.py rename to apps/example_api/api/v2/views.py diff --git a/apps/app_one/apps.py b/apps/example_api/apps.py similarity index 100% rename from apps/app_one/apps.py rename to apps/example_api/apps.py diff --git a/apps/app_one/migrations/__init__.py b/apps/example_api/management/__init__.py similarity index 100% rename from apps/app_one/migrations/__init__.py rename to apps/example_api/management/__init__.py diff --git a/apps/app_one/management/commands.py b/apps/example_api/management/commands/command.py similarity index 100% rename from apps/app_one/management/commands.py rename to apps/example_api/management/commands/command.py diff --git a/apps/app_two/__init__.py b/apps/example_api/migrations/__init__.py similarity index 100% rename from apps/app_two/__init__.py rename to apps/example_api/migrations/__init__.py diff --git a/apps/app_one/models.py b/apps/example_api/models.py similarity index 100% rename from apps/app_one/models.py rename to apps/example_api/models.py diff --git a/apps/app_two/urls.py b/apps/example_api/urls.py similarity index 100% rename from apps/app_two/urls.py rename to apps/example_api/urls.py diff --git a/apps/app_one/utils.py b/apps/example_api/utils.py similarity index 100% rename from apps/app_one/utils.py rename to apps/example_api/utils.py diff --git a/config/urls.py b/config/urls.py index f997b89..e8990bf 100644 --- a/config/urls.py +++ b/config/urls.py @@ -1,21 +1,8 @@ -"""config URL Configuration - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/4.0/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.urls import path +from django.urls import ( + include, + path, +) urlpatterns = [ - path('admin/', admin.site.urls), + path("", include("apps.core.urls", "core")), ] diff --git a/entrypoint.sh b/entrypoint.sh index e69de29..b18bb3d 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +python3 manage.py migrate --noinput +python3 manage.py collectstatic --noinput + +exec "$@" diff --git a/apps/app_two/migrations/__init__.py b/logs/.gitkeep similarity index 100% rename from apps/app_two/migrations/__init__.py rename to logs/.gitkeep diff --git a/apps/app_two/service.py b/media/.gitkeep similarity index 100% rename from apps/app_two/service.py rename to media/.gitkeep diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e337eb8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,5 @@ +[tool.black] +line-length = 79 +target-version = ['py39'] +include = '\.pyi?$' +extend-exclude = 'migrations/*' diff --git a/scripts/.gitkeep b/scripts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/static/.gitkeep b/static/.gitkeep new file mode 100644 index 0000000..e69de29