From cdee5056d651026f839ba94ad7059c5cc76384ef Mon Sep 17 00:00:00 2001 From: Krittipoom Date: Mon, 23 Oct 2023 22:37:22 +0700 Subject: [PATCH] change database from mysql to sqlite --- .docker/docker-compose.yml | 9 ++++ app/Dockerfile | 27 ++++++++++ {code => app}/ddice_online_shop/__init__.py | 0 {code => app}/ddice_online_shop/asgi.py | 0 {code => app}/ddice_online_shop/settings.py | 8 +-- {code => app}/ddice_online_shop/urls.py | 2 +- {code => app}/ddice_online_shop/wsgi.py | 0 {code => app}/dumped_data.json | 0 {code => app}/favicon.ico | Bin {code => app}/main/__init__.py | 0 {code => app}/main/admin.py | 0 {code => app}/main/apps.py | 0 {code => app}/main/form/cloth_form.py | 22 ++++---- {code => app}/main/form/computer_form.py | 21 ++++---- {code => app}/main/form/headphone_form.py | 22 ++++---- {code => app}/main/form/paymethod.py | 0 {code => app}/main/form/smartphone_form.py | 22 ++++---- {code => app}/main/formview/cloth_formview.py | 0 .../main/formview/computer_formview.py | 0 .../main/formview/headphone_formview.py | 0 .../main/formview/smartphone_formview.py | 0 .../get_first_request/get_all_cloth_data.py | 0 .../get_all_computer_data.py | 0 .../get_all_headphone_data.py | 0 .../get_all_smartphone_data.py | 0 {code => app}/main/migrations/0001_initial.py | 0 .../0002_brand_image_computer_image.py | 0 ...ght_alter_computer_has_monitor_and_more.py | 0 ...er_instocks_computer_is_onsale_and_more.py | 0 ...omputer_os_alter_computer_case_and_more.py | 0 ...er_case_alter_computer_display_and_more.py | 0 .../0007_alter_computer_is_laptop.py | 0 ...color_alter_computer_storage_smartphone.py | 0 ...g_price_alter_smartphone_price_and_more.py | 0 ...eadphone_og_price_alter_headphone_price.py | 0 ...etype_headphone_headphone_type_and_more.py | 0 ...camera_smartphone_front_camera_and_more.py | 0 ...me_instocks_computer_in_stocks_and_more.py | 0 ...lter_headphone_frequency_response_cloth.py | 0 .../main/migrations/0015_alter_cloth_size.py | 0 ...th_brand_remove_computer_brand_and_more.py | 0 {code => app}/main/migrations/__init__.py | 0 {code => app}/main/tests.py | 0 {code => app}/main/views.py | 0 {code => app}/manage.py | 0 .../media/model_img/brands/Birdblue.png | Bin .../media/model_img/brands/Ddice.png | Bin {code => app}/media/model_img/brands/Doll.png | Bin .../media/model_img/brands/Heartbeat.png | Bin {code => app}/media/model_img/brands/Kg.png | Bin .../media/model_img/brands/Orange.png | Bin {code => app}/media/model_img/brands/Ros.png | Bin .../media/model_img/brands/Suityou.png | Bin .../media/model_img/brands/Uniqueme.png | Bin {code => app}/media/model_img/brands/Zeus.png | Bin .../cloths/ddice hoodie black uni.png | Bin .../cloths/ddice hoodie blue uni.png | Bin .../cloths/suityou hoodie black uni.png | Bin .../cloths/suityou hoodie red uni.png | Bin .../cloths/suityou hoodie white uni.png | Bin .../cloths/suityou sweatshirt red uni.png | Bin .../cloths/suityou sweatshirt yellow uni.png | Bin .../cloths/suityou tshirt navi male.png | Bin .../cloths/suityou tshirt white male.png | Bin .../cloths/uniqueme hoodie green uni.png | Bin .../cloths/uniqueme hoodie white uni.png | Bin .../uniqueme sleeveless black female.png | Bin .../uniqueme sleeveless grey female.png | Bin .../uniqueme sweatshirt tiedye female.png | Bin .../cloths/uniqueme tshirt black uni.png | Bin .../cloths/uniqueme tshirt orange uni.png | Bin ...designer k0 desktop with monitor black.png | Bin .../kg designer kg0 laptop14 black.png | Bin .../kg designer kg0 laptop156 black.png | Bin .../kg designer kg0 laptop156 white.png | Bin .../orange ranger g5 desktop black.png | Bin .../orange ranger g5 desktop white.png | Bin .../orange sour o7 laptop14 white.png | Bin .../orange sour o7 laptop156 black.png | Bin .../orange sour o7 laptop156 white.png | Bin .../orange sweet o9 laptop156 white.png | Bin .../orange sweet o9 laptop16 white.png | Bin .../zeus lighting zl desktop black.png | Bin .../zeus lighting zl desktop blue.png | Bin .../zeus ocean z7 laptop156 white.png | Bin .../zeus ocean z7 laptop16 white.png | Bin ... thunder zt desktop with monitor white.png | Bin ... headphone aux35 in ear black with mic.png | Bin .../birdblue headphone aux35 on ear black.png | Bin ...eadphone aux35 over ear white with mic.png | Bin ...dblue headphone bluetooth on ear black.png | Bin ...rdblue headphone bluetooth on ear blue.png | Bin ...e headphone typec in ear blue with mic.png | Bin ... headphone usb3 over ear blue with mic.png | Bin .../birdblue headphone usbc on ear black.png | Bin ...rtbeat headphone bluetooth on ear pink.png | Bin ...artbeat headphone bluetooth on ear red.png | Bin ...tbeat headphone bluetooth on ear white.png | Bin .../model_img/smartphones/doll x10 black.png | Bin .../model_img/smartphones/doll x10 white.png | Bin .../model_img/smartphones/doll x11 black.png | Bin .../model_img/smartphones/doll x11 white.png | Bin .../smartphones/orange or19 tablet orange.png | Bin .../smartphones/orange or20 orange.png | Bin .../model_img/smartphones/rose s16 red.png | Bin .../model_img/smartphones/rose s16 white.png | Bin {code => app}/order_manager/__init__.py | 0 {code => app}/order_manager/apps.py | 0 .../order_manager/migrations/0001_initial.py | 0 .../migrations/0002_productitem_is_on_sale.py | 0 ...der_ordered_order_ordered_date_and_more.py | 0 .../0004_alter_orderproductitem_quantity.py | 0 .../migrations/0005_userprofile_address.py | 0 .../order_manager/migrations/__init__.py | 0 {code => app}/order_manager/models.py | 0 {code => app}/products/__init__.py | 0 {code => app}/products/admin.py | 0 {code => app}/products/apps.py | 0 .../products/migrations/0001_initial.py | 0 ..._brand_image_alter_cloth_image_and_more.py | 0 ...er_case_alter_computer_display_and_more.py | 0 ...ame_is_onsale_cloth_is_on_sale_and_more.py | 0 {code => app}/products/migrations/__init__.py | 0 {code => app}/products/models.py | 0 {code => app}/requirements.txt | 3 +- {code => app}/static/css/aos.css | 0 {code => app}/static/css/bootstrap.min.css | 0 {code => app}/static/css/main.css | 0 {code => app}/static/img/favicon.ico | Bin {code => app}/static/img/favicon.webp | Bin {code => app}/static/img/noimage.png | Bin {code => app}/static/js/aos.js | 0 .../static/js/bootstrap.bundle.min.js | 0 {code => app}/static/js/jquery.min.js | 0 {code => app}/templates/account/base.html | 0 {code => app}/templates/account/login.html | 0 {code => app}/templates/base.html | 0 {code => app}/templates/homepage.html | 0 {code => app}/templates/store/checkout.html | 0 .../templates/store/order_summary.html | 0 {code => app}/templates/store/payment.html | 0 {code => app}/templates/store/product.html | 0 .../templates/store/product/cloth.html | 0 .../templates/store/product/computer.html | 0 .../templates/store/product/headphone.html | 0 .../templates/store/product/smartphone.html | 0 .../templates/store/product_no_form.html | 0 code/Dockerfile | 16 ------ code/config/nginx/ddice_online_shop.conf | 18 ------- code/docker-compose.yml | 49 ------------------ compose.yaml | 7 +++ 151 files changed, 95 insertions(+), 131 deletions(-) create mode 100644 .docker/docker-compose.yml create mode 100644 app/Dockerfile rename {code => app}/ddice_online_shop/__init__.py (100%) rename {code => app}/ddice_online_shop/asgi.py (100%) rename {code => app}/ddice_online_shop/settings.py (95%) rename {code => app}/ddice_online_shop/urls.py (99%) rename {code => app}/ddice_online_shop/wsgi.py (100%) rename {code => app}/dumped_data.json (100%) rename {code => app}/favicon.ico (100%) rename {code => app}/main/__init__.py (100%) rename {code => app}/main/admin.py (100%) rename {code => app}/main/apps.py (100%) rename {code => app}/main/form/cloth_form.py (55%) rename {code => app}/main/form/computer_form.py (56%) rename {code => app}/main/form/headphone_form.py (56%) rename {code => app}/main/form/paymethod.py (100%) rename {code => app}/main/form/smartphone_form.py (57%) rename {code => app}/main/formview/cloth_formview.py (100%) rename {code => app}/main/formview/computer_formview.py (100%) rename {code => app}/main/formview/headphone_formview.py (100%) rename {code => app}/main/formview/smartphone_formview.py (100%) rename {code => app}/main/get_first_request/get_all_cloth_data.py (100%) rename {code => app}/main/get_first_request/get_all_computer_data.py (100%) rename {code => app}/main/get_first_request/get_all_headphone_data.py (100%) rename {code => app}/main/get_first_request/get_all_smartphone_data.py (100%) rename {code => app}/main/migrations/0001_initial.py (100%) rename {code => app}/main/migrations/0002_brand_image_computer_image.py (100%) rename {code => app}/main/migrations/0003_computer_weight_alter_computer_has_monitor_and_more.py (100%) rename {code => app}/main/migrations/0004_computer_instocks_computer_is_onsale_and_more.py (100%) rename {code => app}/main/migrations/0005_computer_os_alter_computer_case_and_more.py (100%) rename {code => app}/main/migrations/0006_alter_computer_case_alter_computer_display_and_more.py (100%) rename {code => app}/main/migrations/0007_alter_computer_is_laptop.py (100%) rename {code => app}/main/migrations/0008_computer_color_alter_computer_storage_smartphone.py (100%) rename {code => app}/main/migrations/0009_alter_smartphone_og_price_alter_smartphone_price_and_more.py (100%) rename {code => app}/main/migrations/0010_alter_headphone_og_price_alter_headphone_price.py (100%) rename {code => app}/main/migrations/0011_rename_headphonetype_headphone_headphone_type_and_more.py (100%) rename {code => app}/main/migrations/0012_smartphone_back_camera_smartphone_front_camera_and_more.py (100%) rename {code => app}/main/migrations/0013_rename_instocks_computer_in_stocks_and_more.py (100%) rename {code => app}/main/migrations/0014_alter_headphone_frequency_response_cloth.py (100%) rename {code => app}/main/migrations/0015_alter_cloth_size.py (100%) rename {code => app}/main/migrations/0016_remove_cloth_brand_remove_computer_brand_and_more.py (100%) rename {code => app}/main/migrations/__init__.py (100%) rename {code => app}/main/tests.py (100%) rename {code => app}/main/views.py (100%) rename {code => app}/manage.py (100%) rename {code => app}/media/model_img/brands/Birdblue.png (100%) rename {code => app}/media/model_img/brands/Ddice.png (100%) rename {code => app}/media/model_img/brands/Doll.png (100%) rename {code => app}/media/model_img/brands/Heartbeat.png (100%) rename {code => app}/media/model_img/brands/Kg.png (100%) rename {code => app}/media/model_img/brands/Orange.png (100%) rename {code => app}/media/model_img/brands/Ros.png (100%) rename {code => app}/media/model_img/brands/Suityou.png (100%) rename {code => app}/media/model_img/brands/Uniqueme.png (100%) rename {code => app}/media/model_img/brands/Zeus.png (100%) rename {code => app}/media/model_img/cloths/ddice hoodie black uni.png (100%) rename {code => app}/media/model_img/cloths/ddice hoodie blue uni.png (100%) rename {code => app}/media/model_img/cloths/suityou hoodie black uni.png (100%) rename {code => app}/media/model_img/cloths/suityou hoodie red uni.png (100%) rename {code => app}/media/model_img/cloths/suityou hoodie white uni.png (100%) rename {code => app}/media/model_img/cloths/suityou sweatshirt red uni.png (100%) rename {code => app}/media/model_img/cloths/suityou sweatshirt yellow uni.png (100%) rename {code => app}/media/model_img/cloths/suityou tshirt navi male.png (100%) rename {code => app}/media/model_img/cloths/suityou tshirt white male.png (100%) rename {code => app}/media/model_img/cloths/uniqueme hoodie green uni.png (100%) rename {code => app}/media/model_img/cloths/uniqueme hoodie white uni.png (100%) rename {code => app}/media/model_img/cloths/uniqueme sleeveless black female.png (100%) rename {code => app}/media/model_img/cloths/uniqueme sleeveless grey female.png (100%) rename {code => app}/media/model_img/cloths/uniqueme sweatshirt tiedye female.png (100%) rename {code => app}/media/model_img/cloths/uniqueme tshirt black uni.png (100%) rename {code => app}/media/model_img/cloths/uniqueme tshirt orange uni.png (100%) rename {code => app}/media/model_img/computers/kg designer k0 desktop with monitor black.png (100%) rename {code => app}/media/model_img/computers/kg designer kg0 laptop14 black.png (100%) rename {code => app}/media/model_img/computers/kg designer kg0 laptop156 black.png (100%) rename {code => app}/media/model_img/computers/kg designer kg0 laptop156 white.png (100%) rename {code => app}/media/model_img/computers/orange ranger g5 desktop black.png (100%) rename {code => app}/media/model_img/computers/orange ranger g5 desktop white.png (100%) rename {code => app}/media/model_img/computers/orange sour o7 laptop14 white.png (100%) rename {code => app}/media/model_img/computers/orange sour o7 laptop156 black.png (100%) rename {code => app}/media/model_img/computers/orange sour o7 laptop156 white.png (100%) rename {code => app}/media/model_img/computers/orange sweet o9 laptop156 white.png (100%) rename {code => app}/media/model_img/computers/orange sweet o9 laptop16 white.png (100%) rename {code => app}/media/model_img/computers/zeus lighting zl desktop black.png (100%) rename {code => app}/media/model_img/computers/zeus lighting zl desktop blue.png (100%) rename {code => app}/media/model_img/computers/zeus ocean z7 laptop156 white.png (100%) rename {code => app}/media/model_img/computers/zeus ocean z7 laptop16 white.png (100%) rename {code => app}/media/model_img/computers/zeus thunder zt desktop with monitor white.png (100%) rename {code => app}/media/model_img/headphones/birdblue headphone aux35 in ear black with mic.png (100%) rename {code => app}/media/model_img/headphones/birdblue headphone aux35 on ear black.png (100%) rename {code => app}/media/model_img/headphones/birdblue headphone aux35 over ear white with mic.png (100%) rename {code => app}/media/model_img/headphones/birdblue headphone bluetooth on ear black.png (100%) rename {code => app}/media/model_img/headphones/birdblue headphone bluetooth on ear blue.png (100%) rename {code => app}/media/model_img/headphones/birdblue headphone typec in ear blue with mic.png (100%) rename {code => app}/media/model_img/headphones/birdblue headphone usb3 over ear blue with mic.png (100%) rename {code => app}/media/model_img/headphones/birdblue headphone usbc on ear black.png (100%) rename {code => app}/media/model_img/headphones/heartbeat headphone bluetooth on ear pink.png (100%) rename {code => app}/media/model_img/headphones/heartbeat headphone bluetooth on ear red.png (100%) rename {code => app}/media/model_img/headphones/heartbeat headphone bluetooth on ear white.png (100%) rename {code => app}/media/model_img/smartphones/doll x10 black.png (100%) rename {code => app}/media/model_img/smartphones/doll x10 white.png (100%) rename {code => app}/media/model_img/smartphones/doll x11 black.png (100%) rename {code => app}/media/model_img/smartphones/doll x11 white.png (100%) rename {code => app}/media/model_img/smartphones/orange or19 tablet orange.png (100%) rename {code => app}/media/model_img/smartphones/orange or20 orange.png (100%) rename {code => app}/media/model_img/smartphones/rose s16 red.png (100%) rename {code => app}/media/model_img/smartphones/rose s16 white.png (100%) rename {code => app}/order_manager/__init__.py (100%) rename {code => app}/order_manager/apps.py (100%) rename {code => app}/order_manager/migrations/0001_initial.py (100%) rename {code => app}/order_manager/migrations/0002_productitem_is_on_sale.py (100%) rename {code => app}/order_manager/migrations/0003_order_items_order_ordered_order_ordered_date_and_more.py (100%) rename {code => app}/order_manager/migrations/0004_alter_orderproductitem_quantity.py (100%) rename {code => app}/order_manager/migrations/0005_userprofile_address.py (100%) rename {code => app}/order_manager/migrations/__init__.py (100%) rename {code => app}/order_manager/models.py (100%) rename {code => app}/products/__init__.py (100%) rename {code => app}/products/admin.py (100%) rename {code => app}/products/apps.py (100%) rename {code => app}/products/migrations/0001_initial.py (100%) rename {code => app}/products/migrations/0002_alter_brand_image_alter_cloth_image_and_more.py (100%) rename {code => app}/products/migrations/0003_alter_computer_case_alter_computer_display_and_more.py (100%) rename {code => app}/products/migrations/0004_rename_is_onsale_cloth_is_on_sale_and_more.py (100%) rename {code => app}/products/migrations/__init__.py (100%) rename {code => app}/products/models.py (100%) rename {code => app}/requirements.txt (82%) rename {code => app}/static/css/aos.css (100%) rename {code => app}/static/css/bootstrap.min.css (100%) rename {code => app}/static/css/main.css (100%) rename {code => app}/static/img/favicon.ico (100%) rename {code => app}/static/img/favicon.webp (100%) rename {code => app}/static/img/noimage.png (100%) rename {code => app}/static/js/aos.js (100%) rename {code => app}/static/js/bootstrap.bundle.min.js (100%) rename {code => app}/static/js/jquery.min.js (100%) rename {code => app}/templates/account/base.html (100%) rename {code => app}/templates/account/login.html (100%) rename {code => app}/templates/base.html (100%) rename {code => app}/templates/homepage.html (100%) rename {code => app}/templates/store/checkout.html (100%) rename {code => app}/templates/store/order_summary.html (100%) rename {code => app}/templates/store/payment.html (100%) rename {code => app}/templates/store/product.html (100%) rename {code => app}/templates/store/product/cloth.html (100%) rename {code => app}/templates/store/product/computer.html (100%) rename {code => app}/templates/store/product/headphone.html (100%) rename {code => app}/templates/store/product/smartphone.html (100%) rename {code => app}/templates/store/product_no_form.html (100%) delete mode 100644 code/Dockerfile delete mode 100644 code/config/nginx/ddice_online_shop.conf delete mode 100644 code/docker-compose.yml create mode 100644 compose.yaml diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml new file mode 100644 index 0000000..1f340f8 --- /dev/null +++ b/.docker/docker-compose.yml @@ -0,0 +1,9 @@ +services: + web: + build: + context: app + target: dev-envs + ports: + - '8000:8000' + volumes: + - /var/run/docker.sock:/var/run/docker.sock \ No newline at end of file diff --git a/app/Dockerfile b/app/Dockerfile new file mode 100644 index 0000000..92b5dfa --- /dev/null +++ b/app/Dockerfile @@ -0,0 +1,27 @@ +# syntax=docker/dockerfile:1.4 + +FROM --platform=$BUILDPLATFORM python:3.9-alpine AS builder +EXPOSE 8000 +WORKDIR /app +COPY requirements.txt /app +RUN pip3 install --upgrade pip +RUN pip3 install -r requirements.txt --no-cache-dir +COPY . /app +ENTRYPOINT ["python3"] +RUN python3 manage.py migrate +RUN python3 manage.py loaddata dumped_data.json +CMD ["manage.py", "runserver", "0.0.0.0:8000"] + +FROM builder as dev-envs +RUN <", views.product_computer, name = "view_product_computer"), path("smartphone/product/", views.product_smartphone, name = "view_product_smartphone"), path("headphone/product/", views.product_headphone, name = "view_product_headphone"), diff --git a/code/ddice_online_shop/wsgi.py b/app/ddice_online_shop/wsgi.py similarity index 100% rename from code/ddice_online_shop/wsgi.py rename to app/ddice_online_shop/wsgi.py diff --git a/code/dumped_data.json b/app/dumped_data.json similarity index 100% rename from code/dumped_data.json rename to app/dumped_data.json diff --git a/code/favicon.ico b/app/favicon.ico similarity index 100% rename from code/favicon.ico rename to app/favicon.ico diff --git a/code/main/__init__.py b/app/main/__init__.py similarity index 100% rename from code/main/__init__.py rename to app/main/__init__.py diff --git a/code/main/admin.py b/app/main/admin.py similarity index 100% rename from code/main/admin.py rename to app/main/admin.py diff --git a/code/main/apps.py b/app/main/apps.py similarity index 100% rename from code/main/apps.py rename to app/main/apps.py diff --git a/code/main/form/cloth_form.py b/app/main/form/cloth_form.py similarity index 55% rename from code/main/form/cloth_form.py rename to app/main/form/cloth_form.py index 6a3c3c2..5cdea14 100644 --- a/code/main/form/cloth_form.py +++ b/app/main/form/cloth_form.py @@ -21,16 +21,18 @@ def __init__(self, *args, **kwargs): ] FORM = [] + try: + for q in QUERY_FIELDS: + CHOICES = [] + for x in Cloth.objects.values(q).distinct().order_by(q): + CHOICES.append((x[q], x[q])) - for q in QUERY_FIELDS: - CHOICES = [] - for x in Cloth.objects.values(q).distinct().order_by(q): - CHOICES.append((x[q], x[q])) - - FORM.append( - forms.MultipleChoiceField( - widget=forms.CheckboxSelectMultiple, choices=CHOICES, required=False + FORM.append( + forms.MultipleChoiceField( + widget=forms.CheckboxSelectMultiple, choices=CHOICES, required=False + ) ) - ) - product_available, on_sale, color, gender, cloth_type, size = FORM + product_available, on_sale, color, gender, cloth_type, size = FORM + except: + None \ No newline at end of file diff --git a/code/main/form/computer_form.py b/app/main/form/computer_form.py similarity index 56% rename from code/main/form/computer_form.py rename to app/main/form/computer_form.py index 7d6a3d1..df0e40f 100644 --- a/code/main/form/computer_form.py +++ b/app/main/form/computer_form.py @@ -28,15 +28,18 @@ def __init__(self, *args, **kwargs): FORM = [] - for q in QUERY_FIELDS: - CHOICES = [] - for x in Computer.objects.values(q).distinct().order_by(q): - CHOICES.append((x[q], x[q])) + try: + for q in QUERY_FIELDS: + CHOICES = [] + for x in Computer.objects.values(q).distinct().order_by(q): + CHOICES.append((x[q], x[q])) - FORM.append( - forms.MultipleChoiceField( - widget=forms.CheckboxSelectMultiple, choices=CHOICES, required=False + FORM.append( + forms.MultipleChoiceField( + widget=forms.CheckboxSelectMultiple, choices=CHOICES, required=False + ) ) - ) - product_available, on_sale, laptop, gaming, color, cpu, cpu_brand, ram, gpu, gpu_brand, storage_size, operating_system = FORM \ No newline at end of file + product_available, on_sale, laptop, gaming, color, cpu, cpu_brand, ram, gpu, gpu_brand, storage_size, operating_system = FORM + except: + None \ No newline at end of file diff --git a/code/main/form/headphone_form.py b/app/main/form/headphone_form.py similarity index 56% rename from code/main/form/headphone_form.py rename to app/main/form/headphone_form.py index d311bb6..dac3e6e 100644 --- a/code/main/form/headphone_form.py +++ b/app/main/form/headphone_form.py @@ -25,16 +25,18 @@ def __init__(self, *args, **kwargs): ] FORM = [] + try: + for q in QUERY_FIELDS: + CHOICES = [] + for x in Headphone.objects.values(q).distinct().order_by(q): + CHOICES.append((x[q], x[q])) - for q in QUERY_FIELDS: - CHOICES = [] - for x in Headphone.objects.values(q).distinct().order_by(q): - CHOICES.append((x[q], x[q])) - - FORM.append( - forms.MultipleChoiceField( - widget=forms.CheckboxSelectMultiple, choices=CHOICES, required=False + FORM.append( + forms.MultipleChoiceField( + widget=forms.CheckboxSelectMultiple, choices=CHOICES, required=False + ) ) - ) - product_available, on_sale, is_bluetooth, is_waterproof, has_noise_cancelling, has_microphone, color, headphone_type, port, frequency_response = FORM \ No newline at end of file + product_available, on_sale, is_bluetooth, is_waterproof, has_noise_cancelling, has_microphone, color, headphone_type, port, frequency_response = FORM + except: + None \ No newline at end of file diff --git a/code/main/form/paymethod.py b/app/main/form/paymethod.py similarity index 100% rename from code/main/form/paymethod.py rename to app/main/form/paymethod.py diff --git a/code/main/form/smartphone_form.py b/app/main/form/smartphone_form.py similarity index 57% rename from code/main/form/smartphone_form.py rename to app/main/form/smartphone_form.py index 1f3c5e0..e0559b5 100644 --- a/code/main/form/smartphone_form.py +++ b/app/main/form/smartphone_form.py @@ -28,16 +28,18 @@ def __init__(self, *args, **kwargs): ] FORM = [] + try: + for q in QUERY_FIELDS: + CHOICES = [] + for x in Smartphone.objects.values(q).distinct().order_by(q): + CHOICES.append((x[q], x[q])) - for q in QUERY_FIELDS: - CHOICES = [] - for x in Smartphone.objects.values(q).distinct().order_by(q): - CHOICES.append((x[q], x[q])) - - FORM.append( - forms.MultipleChoiceField( - widget=forms.CheckboxSelectMultiple, choices=CHOICES, required=False + FORM.append( + forms.MultipleChoiceField( + widget=forms.CheckboxSelectMultiple, choices=CHOICES, required=False + ) ) - ) - product_available, on_sale, tablet, flagship, color, processor, processor_brand, ram, storage_size, operating_system, front_camera, back_camera, sim = FORM \ No newline at end of file + product_available, on_sale, tablet, flagship, color, processor, processor_brand, ram, storage_size, operating_system, front_camera, back_camera, sim = FORM + except: + None \ No newline at end of file diff --git a/code/main/formview/cloth_formview.py b/app/main/formview/cloth_formview.py similarity index 100% rename from code/main/formview/cloth_formview.py rename to app/main/formview/cloth_formview.py diff --git a/code/main/formview/computer_formview.py b/app/main/formview/computer_formview.py similarity index 100% rename from code/main/formview/computer_formview.py rename to app/main/formview/computer_formview.py diff --git a/code/main/formview/headphone_formview.py b/app/main/formview/headphone_formview.py similarity index 100% rename from code/main/formview/headphone_formview.py rename to app/main/formview/headphone_formview.py diff --git a/code/main/formview/smartphone_formview.py b/app/main/formview/smartphone_formview.py similarity index 100% rename from code/main/formview/smartphone_formview.py rename to app/main/formview/smartphone_formview.py diff --git a/code/main/get_first_request/get_all_cloth_data.py b/app/main/get_first_request/get_all_cloth_data.py similarity index 100% rename from code/main/get_first_request/get_all_cloth_data.py rename to app/main/get_first_request/get_all_cloth_data.py diff --git a/code/main/get_first_request/get_all_computer_data.py b/app/main/get_first_request/get_all_computer_data.py similarity index 100% rename from code/main/get_first_request/get_all_computer_data.py rename to app/main/get_first_request/get_all_computer_data.py diff --git a/code/main/get_first_request/get_all_headphone_data.py b/app/main/get_first_request/get_all_headphone_data.py similarity index 100% rename from code/main/get_first_request/get_all_headphone_data.py rename to app/main/get_first_request/get_all_headphone_data.py diff --git a/code/main/get_first_request/get_all_smartphone_data.py b/app/main/get_first_request/get_all_smartphone_data.py similarity index 100% rename from code/main/get_first_request/get_all_smartphone_data.py rename to app/main/get_first_request/get_all_smartphone_data.py diff --git a/code/main/migrations/0001_initial.py b/app/main/migrations/0001_initial.py similarity index 100% rename from code/main/migrations/0001_initial.py rename to app/main/migrations/0001_initial.py diff --git a/code/main/migrations/0002_brand_image_computer_image.py b/app/main/migrations/0002_brand_image_computer_image.py similarity index 100% rename from code/main/migrations/0002_brand_image_computer_image.py rename to app/main/migrations/0002_brand_image_computer_image.py diff --git a/code/main/migrations/0003_computer_weight_alter_computer_has_monitor_and_more.py b/app/main/migrations/0003_computer_weight_alter_computer_has_monitor_and_more.py similarity index 100% rename from code/main/migrations/0003_computer_weight_alter_computer_has_monitor_and_more.py rename to app/main/migrations/0003_computer_weight_alter_computer_has_monitor_and_more.py diff --git a/code/main/migrations/0004_computer_instocks_computer_is_onsale_and_more.py b/app/main/migrations/0004_computer_instocks_computer_is_onsale_and_more.py similarity index 100% rename from code/main/migrations/0004_computer_instocks_computer_is_onsale_and_more.py rename to app/main/migrations/0004_computer_instocks_computer_is_onsale_and_more.py diff --git a/code/main/migrations/0005_computer_os_alter_computer_case_and_more.py b/app/main/migrations/0005_computer_os_alter_computer_case_and_more.py similarity index 100% rename from code/main/migrations/0005_computer_os_alter_computer_case_and_more.py rename to app/main/migrations/0005_computer_os_alter_computer_case_and_more.py diff --git a/code/main/migrations/0006_alter_computer_case_alter_computer_display_and_more.py b/app/main/migrations/0006_alter_computer_case_alter_computer_display_and_more.py similarity index 100% rename from code/main/migrations/0006_alter_computer_case_alter_computer_display_and_more.py rename to app/main/migrations/0006_alter_computer_case_alter_computer_display_and_more.py diff --git a/code/main/migrations/0007_alter_computer_is_laptop.py b/app/main/migrations/0007_alter_computer_is_laptop.py similarity index 100% rename from code/main/migrations/0007_alter_computer_is_laptop.py rename to app/main/migrations/0007_alter_computer_is_laptop.py diff --git a/code/main/migrations/0008_computer_color_alter_computer_storage_smartphone.py b/app/main/migrations/0008_computer_color_alter_computer_storage_smartphone.py similarity index 100% rename from code/main/migrations/0008_computer_color_alter_computer_storage_smartphone.py rename to app/main/migrations/0008_computer_color_alter_computer_storage_smartphone.py diff --git a/code/main/migrations/0009_alter_smartphone_og_price_alter_smartphone_price_and_more.py b/app/main/migrations/0009_alter_smartphone_og_price_alter_smartphone_price_and_more.py similarity index 100% rename from code/main/migrations/0009_alter_smartphone_og_price_alter_smartphone_price_and_more.py rename to app/main/migrations/0009_alter_smartphone_og_price_alter_smartphone_price_and_more.py diff --git a/code/main/migrations/0010_alter_headphone_og_price_alter_headphone_price.py b/app/main/migrations/0010_alter_headphone_og_price_alter_headphone_price.py similarity index 100% rename from code/main/migrations/0010_alter_headphone_og_price_alter_headphone_price.py rename to app/main/migrations/0010_alter_headphone_og_price_alter_headphone_price.py diff --git a/code/main/migrations/0011_rename_headphonetype_headphone_headphone_type_and_more.py b/app/main/migrations/0011_rename_headphonetype_headphone_headphone_type_and_more.py similarity index 100% rename from code/main/migrations/0011_rename_headphonetype_headphone_headphone_type_and_more.py rename to app/main/migrations/0011_rename_headphonetype_headphone_headphone_type_and_more.py diff --git a/code/main/migrations/0012_smartphone_back_camera_smartphone_front_camera_and_more.py b/app/main/migrations/0012_smartphone_back_camera_smartphone_front_camera_and_more.py similarity index 100% rename from code/main/migrations/0012_smartphone_back_camera_smartphone_front_camera_and_more.py rename to app/main/migrations/0012_smartphone_back_camera_smartphone_front_camera_and_more.py diff --git a/code/main/migrations/0013_rename_instocks_computer_in_stocks_and_more.py b/app/main/migrations/0013_rename_instocks_computer_in_stocks_and_more.py similarity index 100% rename from code/main/migrations/0013_rename_instocks_computer_in_stocks_and_more.py rename to app/main/migrations/0013_rename_instocks_computer_in_stocks_and_more.py diff --git a/code/main/migrations/0014_alter_headphone_frequency_response_cloth.py b/app/main/migrations/0014_alter_headphone_frequency_response_cloth.py similarity index 100% rename from code/main/migrations/0014_alter_headphone_frequency_response_cloth.py rename to app/main/migrations/0014_alter_headphone_frequency_response_cloth.py diff --git a/code/main/migrations/0015_alter_cloth_size.py b/app/main/migrations/0015_alter_cloth_size.py similarity index 100% rename from code/main/migrations/0015_alter_cloth_size.py rename to app/main/migrations/0015_alter_cloth_size.py diff --git a/code/main/migrations/0016_remove_cloth_brand_remove_computer_brand_and_more.py b/app/main/migrations/0016_remove_cloth_brand_remove_computer_brand_and_more.py similarity index 100% rename from code/main/migrations/0016_remove_cloth_brand_remove_computer_brand_and_more.py rename to app/main/migrations/0016_remove_cloth_brand_remove_computer_brand_and_more.py diff --git a/code/main/migrations/__init__.py b/app/main/migrations/__init__.py similarity index 100% rename from code/main/migrations/__init__.py rename to app/main/migrations/__init__.py diff --git a/code/main/tests.py b/app/main/tests.py similarity index 100% rename from code/main/tests.py rename to app/main/tests.py diff --git a/code/main/views.py b/app/main/views.py similarity index 100% rename from code/main/views.py rename to app/main/views.py diff --git a/code/manage.py b/app/manage.py similarity index 100% rename from code/manage.py rename to app/manage.py diff --git a/code/media/model_img/brands/Birdblue.png b/app/media/model_img/brands/Birdblue.png similarity index 100% rename from code/media/model_img/brands/Birdblue.png rename to app/media/model_img/brands/Birdblue.png diff --git a/code/media/model_img/brands/Ddice.png b/app/media/model_img/brands/Ddice.png similarity index 100% rename from code/media/model_img/brands/Ddice.png rename to app/media/model_img/brands/Ddice.png diff --git a/code/media/model_img/brands/Doll.png b/app/media/model_img/brands/Doll.png similarity index 100% rename from code/media/model_img/brands/Doll.png rename to app/media/model_img/brands/Doll.png diff --git a/code/media/model_img/brands/Heartbeat.png b/app/media/model_img/brands/Heartbeat.png similarity index 100% rename from code/media/model_img/brands/Heartbeat.png rename to app/media/model_img/brands/Heartbeat.png diff --git a/code/media/model_img/brands/Kg.png b/app/media/model_img/brands/Kg.png similarity index 100% rename from code/media/model_img/brands/Kg.png rename to app/media/model_img/brands/Kg.png diff --git a/code/media/model_img/brands/Orange.png b/app/media/model_img/brands/Orange.png similarity index 100% rename from code/media/model_img/brands/Orange.png rename to app/media/model_img/brands/Orange.png diff --git a/code/media/model_img/brands/Ros.png b/app/media/model_img/brands/Ros.png similarity index 100% rename from code/media/model_img/brands/Ros.png rename to app/media/model_img/brands/Ros.png diff --git a/code/media/model_img/brands/Suityou.png b/app/media/model_img/brands/Suityou.png similarity index 100% rename from code/media/model_img/brands/Suityou.png rename to app/media/model_img/brands/Suityou.png diff --git a/code/media/model_img/brands/Uniqueme.png b/app/media/model_img/brands/Uniqueme.png similarity index 100% rename from code/media/model_img/brands/Uniqueme.png rename to app/media/model_img/brands/Uniqueme.png diff --git a/code/media/model_img/brands/Zeus.png b/app/media/model_img/brands/Zeus.png similarity index 100% rename from code/media/model_img/brands/Zeus.png rename to app/media/model_img/brands/Zeus.png diff --git a/code/media/model_img/cloths/ddice hoodie black uni.png b/app/media/model_img/cloths/ddice hoodie black uni.png similarity index 100% rename from code/media/model_img/cloths/ddice hoodie black uni.png rename to app/media/model_img/cloths/ddice hoodie black uni.png diff --git a/code/media/model_img/cloths/ddice hoodie blue uni.png b/app/media/model_img/cloths/ddice hoodie blue uni.png similarity index 100% rename from code/media/model_img/cloths/ddice hoodie blue uni.png rename to app/media/model_img/cloths/ddice hoodie blue uni.png diff --git a/code/media/model_img/cloths/suityou hoodie black uni.png b/app/media/model_img/cloths/suityou hoodie black uni.png similarity index 100% rename from code/media/model_img/cloths/suityou hoodie black uni.png rename to app/media/model_img/cloths/suityou hoodie black uni.png diff --git a/code/media/model_img/cloths/suityou hoodie red uni.png b/app/media/model_img/cloths/suityou hoodie red uni.png similarity index 100% rename from code/media/model_img/cloths/suityou hoodie red uni.png rename to app/media/model_img/cloths/suityou hoodie red uni.png diff --git a/code/media/model_img/cloths/suityou hoodie white uni.png b/app/media/model_img/cloths/suityou hoodie white uni.png similarity index 100% rename from code/media/model_img/cloths/suityou hoodie white uni.png rename to app/media/model_img/cloths/suityou hoodie white uni.png diff --git a/code/media/model_img/cloths/suityou sweatshirt red uni.png b/app/media/model_img/cloths/suityou sweatshirt red uni.png similarity index 100% rename from code/media/model_img/cloths/suityou sweatshirt red uni.png rename to app/media/model_img/cloths/suityou sweatshirt red uni.png diff --git a/code/media/model_img/cloths/suityou sweatshirt yellow uni.png b/app/media/model_img/cloths/suityou sweatshirt yellow uni.png similarity index 100% rename from code/media/model_img/cloths/suityou sweatshirt yellow uni.png rename to app/media/model_img/cloths/suityou sweatshirt yellow uni.png diff --git a/code/media/model_img/cloths/suityou tshirt navi male.png b/app/media/model_img/cloths/suityou tshirt navi male.png similarity index 100% rename from code/media/model_img/cloths/suityou tshirt navi male.png rename to app/media/model_img/cloths/suityou tshirt navi male.png diff --git a/code/media/model_img/cloths/suityou tshirt white male.png b/app/media/model_img/cloths/suityou tshirt white male.png similarity index 100% rename from code/media/model_img/cloths/suityou tshirt white male.png rename to app/media/model_img/cloths/suityou tshirt white male.png diff --git a/code/media/model_img/cloths/uniqueme hoodie green uni.png b/app/media/model_img/cloths/uniqueme hoodie green uni.png similarity index 100% rename from code/media/model_img/cloths/uniqueme hoodie green uni.png rename to app/media/model_img/cloths/uniqueme hoodie green uni.png diff --git a/code/media/model_img/cloths/uniqueme hoodie white uni.png b/app/media/model_img/cloths/uniqueme hoodie white uni.png similarity index 100% rename from code/media/model_img/cloths/uniqueme hoodie white uni.png rename to app/media/model_img/cloths/uniqueme hoodie white uni.png diff --git a/code/media/model_img/cloths/uniqueme sleeveless black female.png b/app/media/model_img/cloths/uniqueme sleeveless black female.png similarity index 100% rename from code/media/model_img/cloths/uniqueme sleeveless black female.png rename to app/media/model_img/cloths/uniqueme sleeveless black female.png diff --git a/code/media/model_img/cloths/uniqueme sleeveless grey female.png b/app/media/model_img/cloths/uniqueme sleeveless grey female.png similarity index 100% rename from code/media/model_img/cloths/uniqueme sleeveless grey female.png rename to app/media/model_img/cloths/uniqueme sleeveless grey female.png diff --git a/code/media/model_img/cloths/uniqueme sweatshirt tiedye female.png b/app/media/model_img/cloths/uniqueme sweatshirt tiedye female.png similarity index 100% rename from code/media/model_img/cloths/uniqueme sweatshirt tiedye female.png rename to app/media/model_img/cloths/uniqueme sweatshirt tiedye female.png diff --git a/code/media/model_img/cloths/uniqueme tshirt black uni.png b/app/media/model_img/cloths/uniqueme tshirt black uni.png similarity index 100% rename from code/media/model_img/cloths/uniqueme tshirt black uni.png rename to app/media/model_img/cloths/uniqueme tshirt black uni.png diff --git a/code/media/model_img/cloths/uniqueme tshirt orange uni.png b/app/media/model_img/cloths/uniqueme tshirt orange uni.png similarity index 100% rename from code/media/model_img/cloths/uniqueme tshirt orange uni.png rename to app/media/model_img/cloths/uniqueme tshirt orange uni.png diff --git a/code/media/model_img/computers/kg designer k0 desktop with monitor black.png b/app/media/model_img/computers/kg designer k0 desktop with monitor black.png similarity index 100% rename from code/media/model_img/computers/kg designer k0 desktop with monitor black.png rename to app/media/model_img/computers/kg designer k0 desktop with monitor black.png diff --git a/code/media/model_img/computers/kg designer kg0 laptop14 black.png b/app/media/model_img/computers/kg designer kg0 laptop14 black.png similarity index 100% rename from code/media/model_img/computers/kg designer kg0 laptop14 black.png rename to app/media/model_img/computers/kg designer kg0 laptop14 black.png diff --git a/code/media/model_img/computers/kg designer kg0 laptop156 black.png b/app/media/model_img/computers/kg designer kg0 laptop156 black.png similarity index 100% rename from code/media/model_img/computers/kg designer kg0 laptop156 black.png rename to app/media/model_img/computers/kg designer kg0 laptop156 black.png diff --git a/code/media/model_img/computers/kg designer kg0 laptop156 white.png b/app/media/model_img/computers/kg designer kg0 laptop156 white.png similarity index 100% rename from code/media/model_img/computers/kg designer kg0 laptop156 white.png rename to app/media/model_img/computers/kg designer kg0 laptop156 white.png diff --git a/code/media/model_img/computers/orange ranger g5 desktop black.png b/app/media/model_img/computers/orange ranger g5 desktop black.png similarity index 100% rename from code/media/model_img/computers/orange ranger g5 desktop black.png rename to app/media/model_img/computers/orange ranger g5 desktop black.png diff --git a/code/media/model_img/computers/orange ranger g5 desktop white.png b/app/media/model_img/computers/orange ranger g5 desktop white.png similarity index 100% rename from code/media/model_img/computers/orange ranger g5 desktop white.png rename to app/media/model_img/computers/orange ranger g5 desktop white.png diff --git a/code/media/model_img/computers/orange sour o7 laptop14 white.png b/app/media/model_img/computers/orange sour o7 laptop14 white.png similarity index 100% rename from code/media/model_img/computers/orange sour o7 laptop14 white.png rename to app/media/model_img/computers/orange sour o7 laptop14 white.png diff --git a/code/media/model_img/computers/orange sour o7 laptop156 black.png b/app/media/model_img/computers/orange sour o7 laptop156 black.png similarity index 100% rename from code/media/model_img/computers/orange sour o7 laptop156 black.png rename to app/media/model_img/computers/orange sour o7 laptop156 black.png diff --git a/code/media/model_img/computers/orange sour o7 laptop156 white.png b/app/media/model_img/computers/orange sour o7 laptop156 white.png similarity index 100% rename from code/media/model_img/computers/orange sour o7 laptop156 white.png rename to app/media/model_img/computers/orange sour o7 laptop156 white.png diff --git a/code/media/model_img/computers/orange sweet o9 laptop156 white.png b/app/media/model_img/computers/orange sweet o9 laptop156 white.png similarity index 100% rename from code/media/model_img/computers/orange sweet o9 laptop156 white.png rename to app/media/model_img/computers/orange sweet o9 laptop156 white.png diff --git a/code/media/model_img/computers/orange sweet o9 laptop16 white.png b/app/media/model_img/computers/orange sweet o9 laptop16 white.png similarity index 100% rename from code/media/model_img/computers/orange sweet o9 laptop16 white.png rename to app/media/model_img/computers/orange sweet o9 laptop16 white.png diff --git a/code/media/model_img/computers/zeus lighting zl desktop black.png b/app/media/model_img/computers/zeus lighting zl desktop black.png similarity index 100% rename from code/media/model_img/computers/zeus lighting zl desktop black.png rename to app/media/model_img/computers/zeus lighting zl desktop black.png diff --git a/code/media/model_img/computers/zeus lighting zl desktop blue.png b/app/media/model_img/computers/zeus lighting zl desktop blue.png similarity index 100% rename from code/media/model_img/computers/zeus lighting zl desktop blue.png rename to app/media/model_img/computers/zeus lighting zl desktop blue.png diff --git a/code/media/model_img/computers/zeus ocean z7 laptop156 white.png b/app/media/model_img/computers/zeus ocean z7 laptop156 white.png similarity index 100% rename from code/media/model_img/computers/zeus ocean z7 laptop156 white.png rename to app/media/model_img/computers/zeus ocean z7 laptop156 white.png diff --git a/code/media/model_img/computers/zeus ocean z7 laptop16 white.png b/app/media/model_img/computers/zeus ocean z7 laptop16 white.png similarity index 100% rename from code/media/model_img/computers/zeus ocean z7 laptop16 white.png rename to app/media/model_img/computers/zeus ocean z7 laptop16 white.png diff --git a/code/media/model_img/computers/zeus thunder zt desktop with monitor white.png b/app/media/model_img/computers/zeus thunder zt desktop with monitor white.png similarity index 100% rename from code/media/model_img/computers/zeus thunder zt desktop with monitor white.png rename to app/media/model_img/computers/zeus thunder zt desktop with monitor white.png diff --git a/code/media/model_img/headphones/birdblue headphone aux35 in ear black with mic.png b/app/media/model_img/headphones/birdblue headphone aux35 in ear black with mic.png similarity index 100% rename from code/media/model_img/headphones/birdblue headphone aux35 in ear black with mic.png rename to app/media/model_img/headphones/birdblue headphone aux35 in ear black with mic.png diff --git a/code/media/model_img/headphones/birdblue headphone aux35 on ear black.png b/app/media/model_img/headphones/birdblue headphone aux35 on ear black.png similarity index 100% rename from code/media/model_img/headphones/birdblue headphone aux35 on ear black.png rename to app/media/model_img/headphones/birdblue headphone aux35 on ear black.png diff --git a/code/media/model_img/headphones/birdblue headphone aux35 over ear white with mic.png b/app/media/model_img/headphones/birdblue headphone aux35 over ear white with mic.png similarity index 100% rename from code/media/model_img/headphones/birdblue headphone aux35 over ear white with mic.png rename to app/media/model_img/headphones/birdblue headphone aux35 over ear white with mic.png diff --git a/code/media/model_img/headphones/birdblue headphone bluetooth on ear black.png b/app/media/model_img/headphones/birdblue headphone bluetooth on ear black.png similarity index 100% rename from code/media/model_img/headphones/birdblue headphone bluetooth on ear black.png rename to app/media/model_img/headphones/birdblue headphone bluetooth on ear black.png diff --git a/code/media/model_img/headphones/birdblue headphone bluetooth on ear blue.png b/app/media/model_img/headphones/birdblue headphone bluetooth on ear blue.png similarity index 100% rename from code/media/model_img/headphones/birdblue headphone bluetooth on ear blue.png rename to app/media/model_img/headphones/birdblue headphone bluetooth on ear blue.png diff --git a/code/media/model_img/headphones/birdblue headphone typec in ear blue with mic.png b/app/media/model_img/headphones/birdblue headphone typec in ear blue with mic.png similarity index 100% rename from code/media/model_img/headphones/birdblue headphone typec in ear blue with mic.png rename to app/media/model_img/headphones/birdblue headphone typec in ear blue with mic.png diff --git a/code/media/model_img/headphones/birdblue headphone usb3 over ear blue with mic.png b/app/media/model_img/headphones/birdblue headphone usb3 over ear blue with mic.png similarity index 100% rename from code/media/model_img/headphones/birdblue headphone usb3 over ear blue with mic.png rename to app/media/model_img/headphones/birdblue headphone usb3 over ear blue with mic.png diff --git a/code/media/model_img/headphones/birdblue headphone usbc on ear black.png b/app/media/model_img/headphones/birdblue headphone usbc on ear black.png similarity index 100% rename from code/media/model_img/headphones/birdblue headphone usbc on ear black.png rename to app/media/model_img/headphones/birdblue headphone usbc on ear black.png diff --git a/code/media/model_img/headphones/heartbeat headphone bluetooth on ear pink.png b/app/media/model_img/headphones/heartbeat headphone bluetooth on ear pink.png similarity index 100% rename from code/media/model_img/headphones/heartbeat headphone bluetooth on ear pink.png rename to app/media/model_img/headphones/heartbeat headphone bluetooth on ear pink.png diff --git a/code/media/model_img/headphones/heartbeat headphone bluetooth on ear red.png b/app/media/model_img/headphones/heartbeat headphone bluetooth on ear red.png similarity index 100% rename from code/media/model_img/headphones/heartbeat headphone bluetooth on ear red.png rename to app/media/model_img/headphones/heartbeat headphone bluetooth on ear red.png diff --git a/code/media/model_img/headphones/heartbeat headphone bluetooth on ear white.png b/app/media/model_img/headphones/heartbeat headphone bluetooth on ear white.png similarity index 100% rename from code/media/model_img/headphones/heartbeat headphone bluetooth on ear white.png rename to app/media/model_img/headphones/heartbeat headphone bluetooth on ear white.png diff --git a/code/media/model_img/smartphones/doll x10 black.png b/app/media/model_img/smartphones/doll x10 black.png similarity index 100% rename from code/media/model_img/smartphones/doll x10 black.png rename to app/media/model_img/smartphones/doll x10 black.png diff --git a/code/media/model_img/smartphones/doll x10 white.png b/app/media/model_img/smartphones/doll x10 white.png similarity index 100% rename from code/media/model_img/smartphones/doll x10 white.png rename to app/media/model_img/smartphones/doll x10 white.png diff --git a/code/media/model_img/smartphones/doll x11 black.png b/app/media/model_img/smartphones/doll x11 black.png similarity index 100% rename from code/media/model_img/smartphones/doll x11 black.png rename to app/media/model_img/smartphones/doll x11 black.png diff --git a/code/media/model_img/smartphones/doll x11 white.png b/app/media/model_img/smartphones/doll x11 white.png similarity index 100% rename from code/media/model_img/smartphones/doll x11 white.png rename to app/media/model_img/smartphones/doll x11 white.png diff --git a/code/media/model_img/smartphones/orange or19 tablet orange.png b/app/media/model_img/smartphones/orange or19 tablet orange.png similarity index 100% rename from code/media/model_img/smartphones/orange or19 tablet orange.png rename to app/media/model_img/smartphones/orange or19 tablet orange.png diff --git a/code/media/model_img/smartphones/orange or20 orange.png b/app/media/model_img/smartphones/orange or20 orange.png similarity index 100% rename from code/media/model_img/smartphones/orange or20 orange.png rename to app/media/model_img/smartphones/orange or20 orange.png diff --git a/code/media/model_img/smartphones/rose s16 red.png b/app/media/model_img/smartphones/rose s16 red.png similarity index 100% rename from code/media/model_img/smartphones/rose s16 red.png rename to app/media/model_img/smartphones/rose s16 red.png diff --git a/code/media/model_img/smartphones/rose s16 white.png b/app/media/model_img/smartphones/rose s16 white.png similarity index 100% rename from code/media/model_img/smartphones/rose s16 white.png rename to app/media/model_img/smartphones/rose s16 white.png diff --git a/code/order_manager/__init__.py b/app/order_manager/__init__.py similarity index 100% rename from code/order_manager/__init__.py rename to app/order_manager/__init__.py diff --git a/code/order_manager/apps.py b/app/order_manager/apps.py similarity index 100% rename from code/order_manager/apps.py rename to app/order_manager/apps.py diff --git a/code/order_manager/migrations/0001_initial.py b/app/order_manager/migrations/0001_initial.py similarity index 100% rename from code/order_manager/migrations/0001_initial.py rename to app/order_manager/migrations/0001_initial.py diff --git a/code/order_manager/migrations/0002_productitem_is_on_sale.py b/app/order_manager/migrations/0002_productitem_is_on_sale.py similarity index 100% rename from code/order_manager/migrations/0002_productitem_is_on_sale.py rename to app/order_manager/migrations/0002_productitem_is_on_sale.py diff --git a/code/order_manager/migrations/0003_order_items_order_ordered_order_ordered_date_and_more.py b/app/order_manager/migrations/0003_order_items_order_ordered_order_ordered_date_and_more.py similarity index 100% rename from code/order_manager/migrations/0003_order_items_order_ordered_order_ordered_date_and_more.py rename to app/order_manager/migrations/0003_order_items_order_ordered_order_ordered_date_and_more.py diff --git a/code/order_manager/migrations/0004_alter_orderproductitem_quantity.py b/app/order_manager/migrations/0004_alter_orderproductitem_quantity.py similarity index 100% rename from code/order_manager/migrations/0004_alter_orderproductitem_quantity.py rename to app/order_manager/migrations/0004_alter_orderproductitem_quantity.py diff --git a/code/order_manager/migrations/0005_userprofile_address.py b/app/order_manager/migrations/0005_userprofile_address.py similarity index 100% rename from code/order_manager/migrations/0005_userprofile_address.py rename to app/order_manager/migrations/0005_userprofile_address.py diff --git a/code/order_manager/migrations/__init__.py b/app/order_manager/migrations/__init__.py similarity index 100% rename from code/order_manager/migrations/__init__.py rename to app/order_manager/migrations/__init__.py diff --git a/code/order_manager/models.py b/app/order_manager/models.py similarity index 100% rename from code/order_manager/models.py rename to app/order_manager/models.py diff --git a/code/products/__init__.py b/app/products/__init__.py similarity index 100% rename from code/products/__init__.py rename to app/products/__init__.py diff --git a/code/products/admin.py b/app/products/admin.py similarity index 100% rename from code/products/admin.py rename to app/products/admin.py diff --git a/code/products/apps.py b/app/products/apps.py similarity index 100% rename from code/products/apps.py rename to app/products/apps.py diff --git a/code/products/migrations/0001_initial.py b/app/products/migrations/0001_initial.py similarity index 100% rename from code/products/migrations/0001_initial.py rename to app/products/migrations/0001_initial.py diff --git a/code/products/migrations/0002_alter_brand_image_alter_cloth_image_and_more.py b/app/products/migrations/0002_alter_brand_image_alter_cloth_image_and_more.py similarity index 100% rename from code/products/migrations/0002_alter_brand_image_alter_cloth_image_and_more.py rename to app/products/migrations/0002_alter_brand_image_alter_cloth_image_and_more.py diff --git a/code/products/migrations/0003_alter_computer_case_alter_computer_display_and_more.py b/app/products/migrations/0003_alter_computer_case_alter_computer_display_and_more.py similarity index 100% rename from code/products/migrations/0003_alter_computer_case_alter_computer_display_and_more.py rename to app/products/migrations/0003_alter_computer_case_alter_computer_display_and_more.py diff --git a/code/products/migrations/0004_rename_is_onsale_cloth_is_on_sale_and_more.py b/app/products/migrations/0004_rename_is_onsale_cloth_is_on_sale_and_more.py similarity index 100% rename from code/products/migrations/0004_rename_is_onsale_cloth_is_on_sale_and_more.py rename to app/products/migrations/0004_rename_is_onsale_cloth_is_on_sale_and_more.py diff --git a/code/products/migrations/__init__.py b/app/products/migrations/__init__.py similarity index 100% rename from code/products/migrations/__init__.py rename to app/products/migrations/__init__.py diff --git a/code/products/models.py b/app/products/models.py similarity index 100% rename from code/products/models.py rename to app/products/models.py diff --git a/code/requirements.txt b/app/requirements.txt similarity index 82% rename from code/requirements.txt rename to app/requirements.txt index 73da0f8..01ab920 100644 --- a/code/requirements.txt +++ b/app/requirements.txt @@ -1,6 +1,5 @@ Django==4.2.5 -mysqlclient==2.2.0 -gunicorn==21.2.0 +environs Pillow==9.5.0 django-extensions==3.2.3 django-crispy-forms==2.0 diff --git a/code/static/css/aos.css b/app/static/css/aos.css similarity index 100% rename from code/static/css/aos.css rename to app/static/css/aos.css diff --git a/code/static/css/bootstrap.min.css b/app/static/css/bootstrap.min.css similarity index 100% rename from code/static/css/bootstrap.min.css rename to app/static/css/bootstrap.min.css diff --git a/code/static/css/main.css b/app/static/css/main.css similarity index 100% rename from code/static/css/main.css rename to app/static/css/main.css diff --git a/code/static/img/favicon.ico b/app/static/img/favicon.ico similarity index 100% rename from code/static/img/favicon.ico rename to app/static/img/favicon.ico diff --git a/code/static/img/favicon.webp b/app/static/img/favicon.webp similarity index 100% rename from code/static/img/favicon.webp rename to app/static/img/favicon.webp diff --git a/code/static/img/noimage.png b/app/static/img/noimage.png similarity index 100% rename from code/static/img/noimage.png rename to app/static/img/noimage.png diff --git a/code/static/js/aos.js b/app/static/js/aos.js similarity index 100% rename from code/static/js/aos.js rename to app/static/js/aos.js diff --git a/code/static/js/bootstrap.bundle.min.js b/app/static/js/bootstrap.bundle.min.js similarity index 100% rename from code/static/js/bootstrap.bundle.min.js rename to app/static/js/bootstrap.bundle.min.js diff --git a/code/static/js/jquery.min.js b/app/static/js/jquery.min.js similarity index 100% rename from code/static/js/jquery.min.js rename to app/static/js/jquery.min.js diff --git a/code/templates/account/base.html b/app/templates/account/base.html similarity index 100% rename from code/templates/account/base.html rename to app/templates/account/base.html diff --git a/code/templates/account/login.html b/app/templates/account/login.html similarity index 100% rename from code/templates/account/login.html rename to app/templates/account/login.html diff --git a/code/templates/base.html b/app/templates/base.html similarity index 100% rename from code/templates/base.html rename to app/templates/base.html diff --git a/code/templates/homepage.html b/app/templates/homepage.html similarity index 100% rename from code/templates/homepage.html rename to app/templates/homepage.html diff --git a/code/templates/store/checkout.html b/app/templates/store/checkout.html similarity index 100% rename from code/templates/store/checkout.html rename to app/templates/store/checkout.html diff --git a/code/templates/store/order_summary.html b/app/templates/store/order_summary.html similarity index 100% rename from code/templates/store/order_summary.html rename to app/templates/store/order_summary.html diff --git a/code/templates/store/payment.html b/app/templates/store/payment.html similarity index 100% rename from code/templates/store/payment.html rename to app/templates/store/payment.html diff --git a/code/templates/store/product.html b/app/templates/store/product.html similarity index 100% rename from code/templates/store/product.html rename to app/templates/store/product.html diff --git a/code/templates/store/product/cloth.html b/app/templates/store/product/cloth.html similarity index 100% rename from code/templates/store/product/cloth.html rename to app/templates/store/product/cloth.html diff --git a/code/templates/store/product/computer.html b/app/templates/store/product/computer.html similarity index 100% rename from code/templates/store/product/computer.html rename to app/templates/store/product/computer.html diff --git a/code/templates/store/product/headphone.html b/app/templates/store/product/headphone.html similarity index 100% rename from code/templates/store/product/headphone.html rename to app/templates/store/product/headphone.html diff --git a/code/templates/store/product/smartphone.html b/app/templates/store/product/smartphone.html similarity index 100% rename from code/templates/store/product/smartphone.html rename to app/templates/store/product/smartphone.html diff --git a/code/templates/store/product_no_form.html b/app/templates/store/product_no_form.html similarity index 100% rename from code/templates/store/product_no_form.html rename to app/templates/store/product_no_form.html diff --git a/code/Dockerfile b/code/Dockerfile deleted file mode 100644 index 3e88910..0000000 --- a/code/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM python:3.9 - -ENV PYTHONUNBUFFERED 1 - - -RUN apt-get update -RUN apt-get install python3-dev build-essential libmariadb-dev default-libmysqlclient-dev -y - -RUN mkdir /code -WORKDIR /code -COPY requirements.txt /code/ -RUN pip install --upgrade pip -RUN pip install -r requirements.txt -COPY . /code/ - -EXPOSE 8000 \ No newline at end of file diff --git a/code/config/nginx/ddice_online_shop.conf b/code/config/nginx/ddice_online_shop.conf deleted file mode 100644 index 59d32c8..0000000 --- a/code/config/nginx/ddice_online_shop.conf +++ /dev/null @@ -1,18 +0,0 @@ -upstream app { - ip_hash; - server app:8000; -} - -server { - listen 8000; - server_name localhost; - - location /static/ { - autoindex on; - alias /code/collected_static/; - } - - location / { - proxy_pass http://app/; - } -} \ No newline at end of file diff --git a/code/docker-compose.yml b/code/docker-compose.yml deleted file mode 100644 index 2ae0e67..0000000 --- a/code/docker-compose.yml +++ /dev/null @@ -1,49 +0,0 @@ -version: "3.9" -services: - app: - restart: always - build: . - command: bash -c "python3 manage.py collectstatic --no-input && python3 manage.py migrate && gunicorn --timeout=30 --workers=4 --bind :8000 ddice_online_shop.wsgi:application" - volumes: - - .:/code - - static-volume:/code/collected_static - expose: - - "8000" - depends_on: - - db - networks: - - web_network - - db_network - db: - image: mysql:8.0 - volumes: - - "./mysql:/var/lib/mysql" - ports: - - "3306:3306" - restart: always - environment: - - MYSQL_ROOT_PASSWORD=ddice - - MYSQL_DATABASE=ddice_online_shop_database - networks: - - db_network - nginx: - restart: always - image: nginx:1.25 - ports: - - "8000:8000" - volumes: - - static-volume:/code/collected_static - - ./config/nginx:/etc/nginx/conf.d - depends_on: - - app - networks: - - web_network - -networks: - web_network: - driver: bridge - db_network: - driver: bridge - -volumes: - static-volume: \ No newline at end of file diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..e4713a9 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,7 @@ +services: + web: + build: + context: app + target: builder + ports: + - '8000:8000' \ No newline at end of file