Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ HOST=0.0.0.0
PORT=8000

# PostgreSQL Configuration (PostgreSQL 16)
POSTGRES_USER=elephant_admin
POSTGRES_USER=fashio_admin
POSTGRES_PASSWORD=SuperSecureAndComplexPassword2026!
POSTGRES_DB=elephant_messenger
POSTGRES_DB=fashio_db
POSTGRES_PORT=42359
POSTGRES_HOST=127.0.0.1

Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Backend Tests

on:
push:
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: ${{ vars.POSTGRES_USER || 'fashio_admin' }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD || 'local_test_password' }}
POSTGRES_DB: ${{ vars.POSTGRES_DB || 'fashio_db' }}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Install uv and set up python
uses: astral-sh/setup-uv@v5
with:
version: "latest"
enable-cache: true
cache-dependency-lock-file: "backend/uv.lock"

- name: Install dependencies
working-directory: backend
run: uv sync --frozen

- name: Run flake8
working-directory: backend
run: |
uv run flake8 . --exclude=.venv --count --select=E9,F63,F7,F82 --show-source --statistics
uv run flake8 . --exclude=.venv --count --exit-zero --max-complexity=10 --max-line-length=119 --statistics

- name: Run black check
working-directory: backend
run: uvx black --check --verbose .

- name: Run pytest
working-directory: backend
run: uv run pytest
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ docker-compose.override.yml
*.bak
*.swp
*.swo
*~
*~

act-history.json
2 changes: 1 addition & 1 deletion backend/apps/authentication/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class AuthenticationConfig(AppConfig):
name = 'apps.authentication'
name = "apps.authentication"
2 changes: 1 addition & 1 deletion backend/apps/catalog/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class CatalogConfig(AppConfig):
name = 'apps.catalog'
name = "apps.catalog"
2 changes: 1 addition & 1 deletion backend/apps/orders/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class OrdersConfig(AppConfig):
name = 'apps.orders'
name = "apps.orders"
2 changes: 1 addition & 1 deletion backend/apps/profiles/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class ProfilesConfig(AppConfig):
name = 'apps.profiles'
name = "apps.profiles"
2 changes: 1 addition & 1 deletion backend/apps/sellers/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class SellersConfig(AppConfig):
name = 'apps.sellers'
name = "apps.sellers"
2 changes: 1 addition & 1 deletion backend/config/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

application = get_asgi_application()
78 changes: 38 additions & 40 deletions backend/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# See https://docs.djangoproject.com/en/6.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-wdf9=9pl_8b1a!3ozlnf2j+3p(do8iq1b78x%gb%2f*&hg=-a%'
SECRET_KEY = "django-insecure-wdf9=9pl_8b1a!3ozlnf2j+3p(do8iq1b78x%gb%2f*&hg=-a%"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Expand All @@ -32,49 +32,47 @@
# Application definition

INSTALLED_APPS = [

'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

'apps.authentication',
'apps.catalog',
'apps.orders',
'apps.profiles',
'apps.sellers',
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"apps.authentication",
"apps.catalog",
"apps.orders",
"apps.profiles",
"apps.sellers",
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = 'config.urls'
ROOT_URLCONF = "config.urls"

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]

WSGI_APPLICATION = 'config.wsgi.application'
WSGI_APPLICATION = "config.wsgi.application"


# Database
Expand All @@ -97,26 +95,26 @@

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]


# Internationalization
# https://docs.djangoproject.com/en/6.1/topics/i18n/

LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = "en-us"

TIME_ZONE = 'UTC'
TIME_ZONE = "UTC"

USE_I18N = True

Expand All @@ -126,14 +124,14 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/6.1/howto/static-files/

STATIC_URL = 'static/'
STATIC_URL = "static/"


# Email
# https://docs.djangoproject.com/en/6.1/topics/email/#topic-email-configuration

MAILERS = {
'default': {
'BACKEND': 'django.core.mail.backends.console.EmailBackend',
"default": {
"BACKEND": "django.core.mail.backends.console.EmailBackend",
},
}
15 changes: 8 additions & 7 deletions backend/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
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,include
from django.urls import path, include

urlpatterns = [
path('admin/', admin.site.urls),
path('authentication/',include('apps.authentication.urls')),
path('catalog/',include('apps.catalog.urls')),
path('order/',include('apps.orders.urls')),
path('profile/',include('apps.profiles.urls')),
path('seller/',include('apps.sellers.urls')),
path("admin/", admin.site.urls),
path("authentication/", include("apps.authentication.urls")),
path("catalog/", include("apps.catalog.urls")),
path("order/", include("apps.orders.urls")),
path("profile/", include("apps.profiles.urls")),
path("seller/", include("apps.sellers.urls")),
]
2 changes: 1 addition & 1 deletion backend/config/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

application = get_wsgi_application()
5 changes: 3 additions & 2 deletions backend/manage.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""

import os
import sys


def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand All @@ -18,5 +19,5 @@ def main():
execute_from_command_line(sys.argv)


if __name__ == '__main__':
if __name__ == "__main__":
main()
8 changes: 8 additions & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ build-backend = "uv_build"

[tool.uv]
package = false

[dependency-groups]
dev = [
"black>=26.5.1",
"flake8>=7.3.0",
"pytest>=9.1.1",
"pytest-django>=4.14.0",
]
2 changes: 2 additions & 0 deletions backend/tests/test_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_addition():
assert 1 + 1 == 2
Loading
Loading