diff --git a/FOSSDB/__init__.py b/src/FOSSDB/__init__.py similarity index 100% rename from FOSSDB/__init__.py rename to src/FOSSDB/__init__.py diff --git a/FOSSDB/apps/account/__init__.py b/src/FOSSDB/apps/account/__init__.py similarity index 100% rename from FOSSDB/apps/account/__init__.py rename to src/FOSSDB/apps/account/__init__.py diff --git a/FOSSDB/apps/account/admin.py b/src/FOSSDB/apps/account/admin.py similarity index 100% rename from FOSSDB/apps/account/admin.py rename to src/FOSSDB/apps/account/admin.py diff --git a/FOSSDB/apps/account/apps.py b/src/FOSSDB/apps/account/apps.py similarity index 100% rename from FOSSDB/apps/account/apps.py rename to src/FOSSDB/apps/account/apps.py diff --git a/FOSSDB/apps/account/forms.py b/src/FOSSDB/apps/account/forms.py similarity index 100% rename from FOSSDB/apps/account/forms.py rename to src/FOSSDB/apps/account/forms.py diff --git a/FOSSDB/apps/account/migrations/0001_initial.py b/src/FOSSDB/apps/account/migrations/0001_initial.py similarity index 100% rename from FOSSDB/apps/account/migrations/0001_initial.py rename to src/FOSSDB/apps/account/migrations/0001_initial.py diff --git a/FOSSDB/apps/account/migrations/__init__.py b/src/FOSSDB/apps/account/migrations/__init__.py similarity index 100% rename from FOSSDB/apps/account/migrations/__init__.py rename to src/FOSSDB/apps/account/migrations/__init__.py diff --git a/FOSSDB/apps/account/models.py b/src/FOSSDB/apps/account/models.py similarity index 97% rename from FOSSDB/apps/account/models.py rename to src/FOSSDB/apps/account/models.py index a4164e6..49c64da 100644 --- a/FOSSDB/apps/account/models.py +++ b/src/FOSSDB/apps/account/models.py @@ -14,7 +14,7 @@ def get_profile_pic_path(instance, filename) -> Path: class User(AbstractUser): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, verbose_name="ID") - profile_picture = models.ImageField(upload_to=get_profile_pic_path, default="profile_pics/default.jpg") + profile_picture = models.ImageField(upload_to=get_profile_pic_path, default="profile-pics/default.jpg") @property def full_name(self): diff --git a/FOSSDB/apps/account/tests.py b/src/FOSSDB/apps/account/tests.py similarity index 100% rename from FOSSDB/apps/account/tests.py rename to src/FOSSDB/apps/account/tests.py diff --git a/FOSSDB/apps/account/urls.py b/src/FOSSDB/apps/account/urls.py similarity index 100% rename from FOSSDB/apps/account/urls.py rename to src/FOSSDB/apps/account/urls.py diff --git a/FOSSDB/apps/account/views.py b/src/FOSSDB/apps/account/views.py similarity index 100% rename from FOSSDB/apps/account/views.py rename to src/FOSSDB/apps/account/views.py diff --git a/FOSSDB/apps/fossdb/__init__.py b/src/FOSSDB/apps/fossdb/__init__.py similarity index 100% rename from FOSSDB/apps/fossdb/__init__.py rename to src/FOSSDB/apps/fossdb/__init__.py diff --git a/FOSSDB/apps/fossdb/admin.py b/src/FOSSDB/apps/fossdb/admin.py similarity index 100% rename from FOSSDB/apps/fossdb/admin.py rename to src/FOSSDB/apps/fossdb/admin.py diff --git a/FOSSDB/apps/fossdb/apps.py b/src/FOSSDB/apps/fossdb/apps.py similarity index 100% rename from FOSSDB/apps/fossdb/apps.py rename to src/FOSSDB/apps/fossdb/apps.py diff --git a/FOSSDB/apps/fossdb/filters.py b/src/FOSSDB/apps/fossdb/filters.py similarity index 100% rename from FOSSDB/apps/fossdb/filters.py rename to src/FOSSDB/apps/fossdb/filters.py diff --git a/FOSSDB/apps/fossdb/forms.py b/src/FOSSDB/apps/fossdb/forms.py similarity index 100% rename from FOSSDB/apps/fossdb/forms.py rename to src/FOSSDB/apps/fossdb/forms.py diff --git a/FOSSDB/apps/fossdb/hosting_platform/forms.py b/src/FOSSDB/apps/fossdb/hosting_platform/forms.py similarity index 100% rename from FOSSDB/apps/fossdb/hosting_platform/forms.py rename to src/FOSSDB/apps/fossdb/hosting_platform/forms.py diff --git a/FOSSDB/apps/fossdb/hosting_platform/models.py b/src/FOSSDB/apps/fossdb/hosting_platform/models.py similarity index 100% rename from FOSSDB/apps/fossdb/hosting_platform/models.py rename to src/FOSSDB/apps/fossdb/hosting_platform/models.py diff --git a/FOSSDB/apps/fossdb/license/models.py b/src/FOSSDB/apps/fossdb/license/models.py similarity index 100% rename from FOSSDB/apps/fossdb/license/models.py rename to src/FOSSDB/apps/fossdb/license/models.py diff --git a/FOSSDB/apps/fossdb/migrations/0001_initial.py b/src/FOSSDB/apps/fossdb/migrations/0001_initial.py similarity index 100% rename from FOSSDB/apps/fossdb/migrations/0001_initial.py rename to src/FOSSDB/apps/fossdb/migrations/0001_initial.py diff --git a/FOSSDB/apps/fossdb/migrations/0002_alter_tag_icon.py b/src/FOSSDB/apps/fossdb/migrations/0002_alter_tag_icon.py similarity index 100% rename from FOSSDB/apps/fossdb/migrations/0002_alter_tag_icon.py rename to src/FOSSDB/apps/fossdb/migrations/0002_alter_tag_icon.py diff --git a/FOSSDB/apps/fossdb/migrations/0003_alter_projectprogramminglanguage_percentage.py b/src/FOSSDB/apps/fossdb/migrations/0003_alter_projectprogramminglanguage_percentage.py similarity index 100% rename from FOSSDB/apps/fossdb/migrations/0003_alter_projectprogramminglanguage_percentage.py rename to src/FOSSDB/apps/fossdb/migrations/0003_alter_projectprogramminglanguage_percentage.py diff --git a/FOSSDB/apps/fossdb/migrations/__init__.py b/src/FOSSDB/apps/fossdb/migrations/__init__.py similarity index 100% rename from FOSSDB/apps/fossdb/migrations/__init__.py rename to src/FOSSDB/apps/fossdb/migrations/__init__.py diff --git a/FOSSDB/apps/fossdb/models.py b/src/FOSSDB/apps/fossdb/models.py similarity index 100% rename from FOSSDB/apps/fossdb/models.py rename to src/FOSSDB/apps/fossdb/models.py diff --git a/FOSSDB/apps/fossdb/operating_system/models.py b/src/FOSSDB/apps/fossdb/operating_system/models.py similarity index 100% rename from FOSSDB/apps/fossdb/operating_system/models.py rename to src/FOSSDB/apps/fossdb/operating_system/models.py diff --git a/FOSSDB/apps/fossdb/programming_language/forms.py b/src/FOSSDB/apps/fossdb/programming_language/forms.py similarity index 100% rename from FOSSDB/apps/fossdb/programming_language/forms.py rename to src/FOSSDB/apps/fossdb/programming_language/forms.py diff --git a/FOSSDB/apps/fossdb/programming_language/models.py b/src/FOSSDB/apps/fossdb/programming_language/models.py similarity index 100% rename from FOSSDB/apps/fossdb/programming_language/models.py rename to src/FOSSDB/apps/fossdb/programming_language/models.py diff --git a/FOSSDB/apps/fossdb/star/models.py b/src/FOSSDB/apps/fossdb/star/models.py similarity index 100% rename from FOSSDB/apps/fossdb/star/models.py rename to src/FOSSDB/apps/fossdb/star/models.py diff --git a/FOSSDB/apps/fossdb/tag/models.py b/src/FOSSDB/apps/fossdb/tag/models.py similarity index 100% rename from FOSSDB/apps/fossdb/tag/models.py rename to src/FOSSDB/apps/fossdb/tag/models.py diff --git a/FOSSDB/apps/fossdb/tests.py b/src/FOSSDB/apps/fossdb/tests.py similarity index 100% rename from FOSSDB/apps/fossdb/tests.py rename to src/FOSSDB/apps/fossdb/tests.py diff --git a/FOSSDB/apps/fossdb/urls.py b/src/FOSSDB/apps/fossdb/urls.py similarity index 100% rename from FOSSDB/apps/fossdb/urls.py rename to src/FOSSDB/apps/fossdb/urls.py diff --git a/FOSSDB/apps/fossdb/views.py b/src/FOSSDB/apps/fossdb/views.py similarity index 100% rename from FOSSDB/apps/fossdb/views.py rename to src/FOSSDB/apps/fossdb/views.py diff --git a/FOSSDB/asgi.py b/src/FOSSDB/asgi.py similarity index 100% rename from FOSSDB/asgi.py rename to src/FOSSDB/asgi.py diff --git a/FOSSDB/settings.py b/src/FOSSDB/settings.py similarity index 90% rename from FOSSDB/settings.py rename to src/FOSSDB/settings.py index bc2bd4c..23c7b7e 100644 --- a/FOSSDB/settings.py +++ b/src/FOSSDB/settings.py @@ -21,7 +21,7 @@ sys.path.insert(0, str(BASE_PATH.joinpath("FOSSDB", "apps"))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ -with open(BASE_PATH.joinpath("config.json"), "r", encoding="UTF-8") as config_file: +with open(BASE_PATH.parent / "config.json", "r", encoding="UTF-8") as config_file: config = json.load(config_file) # SECURITY WARNING: keep the secret key used in production secret! @@ -61,7 +61,9 @@ ROOT_URLCONF = "FOSSDB.urls" TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [BASE_PATH.joinpath("templates")], + "DIRS": [ + BASE_PATH / "templates", + ], "APP_DIRS": True, "OPTIONS": { "context_processors": [ @@ -128,10 +130,17 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.0/howto/static-files/ -STATIC_URL = "/static/" -STATIC_ROOT = BASE_PATH.joinpath("static") -MEDIA_URL = "/media/" -MEDIA_ROOT = BASE_PATH.joinpath("media") +STATIC_URL = "static/" +STATICFILE_DIRS = [ + BASE_PATH / "static", +] +STATIC_ROOT = BASE_PATH.parent / "local-cdn" / "static" + +MEDIA_URL = "media/" +MEDIAFILES_DIRS = [ + BASE_PATH / "media", +] +MEDIA_ROOT = BASE_PATH.parent / "local-cdn" / "media" # Default primary key field type # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field diff --git a/FOSSDB/urls.py b/src/FOSSDB/urls.py similarity index 79% rename from FOSSDB/urls.py rename to src/FOSSDB/urls.py index af7155c..9310a1d 100644 --- a/FOSSDB/urls.py +++ b/src/FOSSDB/urls.py @@ -14,7 +14,6 @@ Including another URLconf 2. Add a URL to urlpatterns: path("blog/", include("blog.urls")) """ from django.conf import settings -from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path @@ -24,6 +23,8 @@ urlpatterns = [ path("", include("account.urls")), path("", include("django.contrib.auth.urls")), ] +if settings.DEBUG: + from django.conf.urls.static import static -urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) -urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/FOSSDB/wsgi.py b/src/FOSSDB/wsgi.py similarity index 100% rename from FOSSDB/wsgi.py rename to src/FOSSDB/wsgi.py diff --git a/manage.py b/src/manage.py similarity index 100% rename from manage.py rename to src/manage.py diff --git a/src/media/profile-pics/940e8e9e-77d4-42bb-84fd-04d332de403b.png b/src/media/profile-pics/940e8e9e-77d4-42bb-84fd-04d332de403b.png new file mode 100644 index 0000000..a8c7eba Binary files /dev/null and b/src/media/profile-pics/940e8e9e-77d4-42bb-84fd-04d332de403b.png differ diff --git a/media/profile_pics/default.jpg b/src/media/profile-pics/default.jpg similarity index 100% rename from media/profile_pics/default.jpg rename to src/media/profile-pics/default.jpg diff --git a/templates/account/login.html b/src/templates/account/login.html similarity index 100% rename from templates/account/login.html rename to src/templates/account/login.html diff --git a/templates/account/profile.html b/src/templates/account/profile.html similarity index 100% rename from templates/account/profile.html rename to src/templates/account/profile.html diff --git a/templates/account/signup.html b/src/templates/account/signup.html similarity index 100% rename from templates/account/signup.html rename to src/templates/account/signup.html diff --git a/templates/fossdb/create_view.html b/src/templates/fossdb/create_view.html similarity index 100% rename from templates/fossdb/create_view.html rename to src/templates/fossdb/create_view.html diff --git a/templates/fossdb/delete_view.html b/src/templates/fossdb/delete_view.html similarity index 100% rename from templates/fossdb/delete_view.html rename to src/templates/fossdb/delete_view.html diff --git a/templates/fossdb/detailed_view.html b/src/templates/fossdb/detailed_view.html similarity index 100% rename from templates/fossdb/detailed_view.html rename to src/templates/fossdb/detailed_view.html diff --git a/templates/fossdb/index.html b/src/templates/fossdb/index.html similarity index 100% rename from templates/fossdb/index.html rename to src/templates/fossdb/index.html diff --git a/templates/layout.html b/src/templates/layout.html similarity index 100% rename from templates/layout.html rename to src/templates/layout.html