From 43307c036cb82aab9c0f9f2567972f4b0cd0cbce Mon Sep 17 00:00:00 2001 From: Neda Moeini <neda.moeini@geant.org> Date: Mon, 21 Oct 2024 15:59:57 +0200 Subject: [PATCH] Restructure the project layout --- MANIFEST.in | 8 ++++---- {file_validator => sage_validation}/__init__.py | 0 {root => sage_validation}/asgi.py | 0 .../file_validator}/__init__.py | 0 .../file_validator}/admin.py | 0 .../file_validator}/apps.py | 2 +- .../file_validator}/forms.py | 0 .../file_validator/migrations}/__init__.py | 0 .../file_validator}/models.py | 0 .../file_validator}/templates/upload.html | 0 .../file_validator}/tests.py | 0 .../file_validator}/urls.py | 2 +- .../file_validator}/views.py | 2 +- {root => sage_validation}/settings.py | 12 ++++++------ .../static}/images/geant_logo.svg | 0 {templates => sage_validation/templates}/base.html | 0 {templates => sage_validation/templates}/index.html | 0 {theme => sage_validation/theme}/__init__.py | 0 {theme => sage_validation/theme}/apps.py | 2 +- .../theme}/static/css/dist/styles.css | 0 .../theme}/static_src/.gitignore | 0 .../theme}/static_src/package-lock.json | 0 .../theme}/static_src/package.json | 4 ++-- .../theme}/static_src/postcss.config.js | 0 .../theme}/static_src/src/styles.css | 0 .../theme}/static_src/tailwind.config.js | 0 {theme => sage_validation/theme}/templates/base.html | 0 {root => sage_validation}/urls.py | 4 ++-- {root => sage_validation}/wsgi.py | 2 +- 29 files changed, 19 insertions(+), 19 deletions(-) rename {file_validator => sage_validation}/__init__.py (100%) rename {root => sage_validation}/asgi.py (100%) rename {file_validator/migrations => sage_validation/file_validator}/__init__.py (100%) rename {file_validator => sage_validation/file_validator}/admin.py (100%) rename {file_validator => sage_validation/file_validator}/apps.py (83%) rename {file_validator => sage_validation/file_validator}/forms.py (100%) rename {root => sage_validation/file_validator/migrations}/__init__.py (100%) rename {file_validator => sage_validation/file_validator}/models.py (100%) rename {file_validator => sage_validation/file_validator}/templates/upload.html (100%) rename {file_validator => sage_validation/file_validator}/tests.py (100%) rename {file_validator => sage_validation/file_validator}/urls.py (70%) rename {file_validator => sage_validation/file_validator}/views.py (95%) rename {root => sage_validation}/settings.py (93%) rename {static => sage_validation/static}/images/geant_logo.svg (100%) rename {templates => sage_validation/templates}/base.html (100%) rename {templates => sage_validation/templates}/index.html (100%) rename {theme => sage_validation/theme}/__init__.py (100%) rename {theme => sage_validation/theme}/apps.py (65%) rename {theme => sage_validation/theme}/static/css/dist/styles.css (100%) rename {theme => sage_validation/theme}/static_src/.gitignore (100%) rename {theme => sage_validation/theme}/static_src/package-lock.json (100%) rename {theme => sage_validation/theme}/static_src/package.json (86%) rename {theme => sage_validation/theme}/static_src/postcss.config.js (100%) rename {theme => sage_validation/theme}/static_src/src/styles.css (100%) rename {theme => sage_validation/theme}/static_src/tailwind.config.js (100%) rename {theme => sage_validation/theme}/templates/base.html (100%) rename {root => sage_validation}/urls.py (64%) rename {root => sage_validation}/wsgi.py (81%) diff --git a/MANIFEST.in b/MANIFEST.in index c475ff5..3c30a98 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -recursive-include file_validator/templates * -recursive-include theme/static * -recursive-include theme/templates * -include manage.py \ No newline at end of file +recursive-include sage_validation/file_validator/templates * +recursive-include sage_validation/file_validator/static * +recursive-include sage_validation/theme/static * +recursive-include sage_validation/theme/templates * \ No newline at end of file diff --git a/file_validator/__init__.py b/sage_validation/__init__.py similarity index 100% rename from file_validator/__init__.py rename to sage_validation/__init__.py diff --git a/root/asgi.py b/sage_validation/asgi.py similarity index 100% rename from root/asgi.py rename to sage_validation/asgi.py diff --git a/file_validator/migrations/__init__.py b/sage_validation/file_validator/__init__.py similarity index 100% rename from file_validator/migrations/__init__.py rename to sage_validation/file_validator/__init__.py diff --git a/file_validator/admin.py b/sage_validation/file_validator/admin.py similarity index 100% rename from file_validator/admin.py rename to sage_validation/file_validator/admin.py diff --git a/file_validator/apps.py b/sage_validation/file_validator/apps.py similarity index 83% rename from file_validator/apps.py rename to sage_validation/file_validator/apps.py index 171df15..bd972d5 100644 --- a/file_validator/apps.py +++ b/sage_validation/file_validator/apps.py @@ -6,4 +6,4 @@ class FileValidatorConfig(AppConfig): """App configuration for file_validator.""" default_auto_field = "django.db.models.BigAutoField" - name = "file_validator" + name = "sage_validation.file_validator" diff --git a/file_validator/forms.py b/sage_validation/file_validator/forms.py similarity index 100% rename from file_validator/forms.py rename to sage_validation/file_validator/forms.py diff --git a/root/__init__.py b/sage_validation/file_validator/migrations/__init__.py similarity index 100% rename from root/__init__.py rename to sage_validation/file_validator/migrations/__init__.py diff --git a/file_validator/models.py b/sage_validation/file_validator/models.py similarity index 100% rename from file_validator/models.py rename to sage_validation/file_validator/models.py diff --git a/file_validator/templates/upload.html b/sage_validation/file_validator/templates/upload.html similarity index 100% rename from file_validator/templates/upload.html rename to sage_validation/file_validator/templates/upload.html diff --git a/file_validator/tests.py b/sage_validation/file_validator/tests.py similarity index 100% rename from file_validator/tests.py rename to sage_validation/file_validator/tests.py diff --git a/file_validator/urls.py b/sage_validation/file_validator/urls.py similarity index 70% rename from file_validator/urls.py rename to sage_validation/file_validator/urls.py index af5c733..78e88de 100644 --- a/file_validator/urls.py +++ b/sage_validation/file_validator/urls.py @@ -1,7 +1,7 @@ """Urls for the file_validator app.""" from django.urls import path -from file_validator.views import CSVUploadView +from sage_validation.file_validator.views import CSVUploadView urlpatterns = [ path("upload/", CSVUploadView.as_view(), name="upload-file"), diff --git a/file_validator/views.py b/sage_validation/file_validator/views.py similarity index 95% rename from file_validator/views.py rename to sage_validation/file_validator/views.py index 3dfc3b3..3f75b92 100644 --- a/file_validator/views.py +++ b/sage_validation/file_validator/views.py @@ -4,7 +4,7 @@ from django.shortcuts import render from django.urls import reverse_lazy from django.views.generic.edit import FormView -from file_validator.forms import CSVUploadForm +from sage_validation.file_validator.forms import CSVUploadForm def index_view(request: HttpRequest) -> HttpResponse: diff --git a/root/settings.py b/sage_validation/settings.py similarity index 93% rename from root/settings.py rename to sage_validation/settings.py index 41c166d..1cfee8b 100644 --- a/root/settings.py +++ b/sage_validation/settings.py @@ -12,7 +12,7 @@ import os from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. -BASE_DIR = Path(__file__).resolve().parent.parent +BASE_DIR = Path(__file__).resolve().parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ @@ -36,10 +36,10 @@ INSTALLED_APPS = [ ] THIRD_PARTY_APPS = [ "tailwind", - "theme", + "sage_validation.theme", ] LOCAL_APPS = [ - "file_validator", + "sage_validation.file_validator", ] INSTALLED_APPS += THIRD_PARTY_APPS + LOCAL_APPS @@ -54,7 +54,7 @@ MIDDLEWARE = [ "django.middleware.clickjacking.XFrameOptionsMiddleware", ] -ROOT_URLCONF = "root.urls" +ROOT_URLCONF = "sage_validation.urls" TEMPLATES = [ { @@ -72,7 +72,7 @@ TEMPLATES = [ }, ] -WSGI_APPLICATION = "root.wsgi.application" +WSGI_APPLICATION = "sage_validation.wsgi.application" # Database # https://docs.djangoproject.com/en/5.1/ref/settings/#databases @@ -129,5 +129,5 @@ TAILWIND_APP_NAME = "theme" STATIC_ROOT = BASE_DIR / "staticfiles" STATICFILES_DIRS = [ - BASE_DIR / "static", + BASE_DIR / "sage_validation/static", ] diff --git a/static/images/geant_logo.svg b/sage_validation/static/images/geant_logo.svg similarity index 100% rename from static/images/geant_logo.svg rename to sage_validation/static/images/geant_logo.svg diff --git a/templates/base.html b/sage_validation/templates/base.html similarity index 100% rename from templates/base.html rename to sage_validation/templates/base.html diff --git a/templates/index.html b/sage_validation/templates/index.html similarity index 100% rename from templates/index.html rename to sage_validation/templates/index.html diff --git a/theme/__init__.py b/sage_validation/theme/__init__.py similarity index 100% rename from theme/__init__.py rename to sage_validation/theme/__init__.py diff --git a/theme/apps.py b/sage_validation/theme/apps.py similarity index 65% rename from theme/apps.py rename to sage_validation/theme/apps.py index bec7464..b8bd9c4 100644 --- a/theme/apps.py +++ b/sage_validation/theme/apps.py @@ -2,4 +2,4 @@ from django.apps import AppConfig class ThemeConfig(AppConfig): - name = 'theme' + name = 'sage_validation.theme' diff --git a/theme/static/css/dist/styles.css b/sage_validation/theme/static/css/dist/styles.css similarity index 100% rename from theme/static/css/dist/styles.css rename to sage_validation/theme/static/css/dist/styles.css diff --git a/theme/static_src/.gitignore b/sage_validation/theme/static_src/.gitignore similarity index 100% rename from theme/static_src/.gitignore rename to sage_validation/theme/static_src/.gitignore diff --git a/theme/static_src/package-lock.json b/sage_validation/theme/static_src/package-lock.json similarity index 100% rename from theme/static_src/package-lock.json rename to sage_validation/theme/static_src/package-lock.json diff --git a/theme/static_src/package.json b/sage_validation/theme/static_src/package.json similarity index 86% rename from theme/static_src/package.json rename to sage_validation/theme/static_src/package.json index a391915..0ac2775 100644 --- a/theme/static_src/package.json +++ b/sage_validation/theme/static_src/package.json @@ -6,8 +6,8 @@ "start": "npm run dev", "build": "npm run build:clean && npm run build:tailwind", "build:clean": "rimraf ../static/css/dist", - "build:tailwind": "cross-env NODE_ENV=production tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css --minify", - "dev": "cross-env NODE_ENV=development tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css -w", + "build:tailwind": "cross-env NODE_ENV=production tailwindcss --postcss -i src/styles.css -o ../static/css/dist/styles.css --minify", + "dev": "cross-env NODE_ENV=development tailwindcss --postcss -i src/styles.css -o ../static/css/dist/styles.css -w", "tailwindcss": "node ./node_modules/tailwindcss/lib/cli.js" }, "keywords": [], diff --git a/theme/static_src/postcss.config.js b/sage_validation/theme/static_src/postcss.config.js similarity index 100% rename from theme/static_src/postcss.config.js rename to sage_validation/theme/static_src/postcss.config.js diff --git a/theme/static_src/src/styles.css b/sage_validation/theme/static_src/src/styles.css similarity index 100% rename from theme/static_src/src/styles.css rename to sage_validation/theme/static_src/src/styles.css diff --git a/theme/static_src/tailwind.config.js b/sage_validation/theme/static_src/tailwind.config.js similarity index 100% rename from theme/static_src/tailwind.config.js rename to sage_validation/theme/static_src/tailwind.config.js diff --git a/theme/templates/base.html b/sage_validation/theme/templates/base.html similarity index 100% rename from theme/templates/base.html rename to sage_validation/theme/templates/base.html diff --git a/root/urls.py b/sage_validation/urls.py similarity index 64% rename from root/urls.py rename to sage_validation/urls.py index f645760..af6d615 100644 --- a/root/urls.py +++ b/sage_validation/urls.py @@ -3,11 +3,11 @@ from django.contrib import admin from django.urls import path from django.urls.conf import include -from file_validator.views import index_view +from sage_validation.file_validator.views import index_view urlpatterns = [ path("admin/", admin.site.urls), - path("file-validator/", include("file_validator.urls")), + path("file-validator/", include("sage_validation.file_validator.urls")), path("", index_view, name="index"), ] diff --git a/root/wsgi.py b/sage_validation/wsgi.py similarity index 81% rename from root/wsgi.py rename to sage_validation/wsgi.py index 095478e..47bc4bb 100644 --- a/root/wsgi.py +++ b/sage_validation/wsgi.py @@ -10,6 +10,6 @@ import os from django.core.wsgi import get_wsgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "root.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sage_validation.settings") application = get_wsgi_application() -- GitLab