diff --git a/.env.example b/.env.example
index 77bf4c3..f1fd122 100644
--- a/.env.example
+++ b/.env.example
@@ -1 +1,2 @@
-SECRET_KEY=
\ No newline at end of file
+SECRET_KEY=
+ENVIRONMENT=
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 89625b1..497227b 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,26 +4,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -106,8 +90,17 @@
1709421008833
-
+
+
+
+ 1709422770100
+
+
+
+ 1709422770100
+
+
@@ -118,5 +111,7 @@
+
+
\ No newline at end of file
diff --git a/products/__init__.py b/products/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/products/admin.py b/products/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/products/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/products/apps.py b/products/apps.py
new file mode 100644
index 0000000..145a2ac
--- /dev/null
+++ b/products/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class ProductsConfig(AppConfig):
+ default_auto_field = 'django.db.models.BigAutoField'
+ name = 'products'
diff --git a/products/migrations/__init__.py b/products/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/products/models.py b/products/models.py
new file mode 100644
index 0000000..71a8362
--- /dev/null
+++ b/products/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/products/tests.py b/products/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/products/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/products/views.py b/products/views.py
new file mode 100644
index 0000000..91ea44a
--- /dev/null
+++ b/products/views.py
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
diff --git a/store/settings.py b/store/settings.py
index 149e6d0..28198dd 100644
--- a/store/settings.py
+++ b/store/settings.py
@@ -16,7 +16,6 @@ import os
load_dotenv()
-
ENVIRONMENT = os.environ.get('ENVIRONMENT')
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@@ -38,15 +37,24 @@ elif ENVIRONMENT == 'development':
# Application definition
-INSTALLED_APPS = [
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
+DJANGO_APPS = ['django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
]
+THIRD_PARTY_APPS = [
+ 'rest_framework'
+]
+
+LOCAL_APPS = [
+ 'products.apps.ProductsConfig',
+]
+
+INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
+
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
@@ -62,7 +70,7 @@ ROOT_URLCONF = 'store.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [BASE_DIR / 'templates']
+ 'DIRS': []
,
'APP_DIRS': True,
'OPTIONS': {
@@ -81,13 +89,30 @@ WSGI_APPLICATION = 'store.wsgi.application'
# Database
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': BASE_DIR / 'db.sqlite3',
- }
-}
+# DATABASES = {
+# 'default': {
+# 'ENGINE': 'django.db.backends.sqlite3',
+# 'NAME': BASE_DIR / 'db.sqlite3',
+# }
+# }
+if ENVIRONMENT == 'development':
+ DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': BASE_DIR / 'db.sqlite3',
+ }
+ }
+elif ENVIRONMENT == 'production':
+ DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.postgresql',
+ 'NAME': os.environ.get("DB_NAME"),
+ 'USER': os.environ.get("DB_USER"),
+ 'PASSWORD': os.environ.get("DB_PASSWORD"),
+ 'HOST': os.environ.get("DB_HOST")
+ }
+ }
# Password validation
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators