From 1e505a8a24e018eb1093356f9e1e22ee695fad7a Mon Sep 17 00:00:00 2001 From: Babit Shrestha Date: Sat, 11 Jan 2025 12:31:05 +0545 Subject: [PATCH] Project innitiation --- .gitignore | 1 + requirements.txt | 5 + sahara/db.sqlite3 | 0 sahara/main/__init__.py | 0 .../main/__pycache__/__init__.cpython-312.pyc | Bin 0 -> 145 bytes sahara/main/__pycache__/admin.cpython-312.pyc | Bin 0 -> 189 bytes sahara/main/__pycache__/apps.cpython-312.pyc | Bin 0 -> 447 bytes .../main/__pycache__/models.cpython-312.pyc | Bin 0 -> 2434 bytes sahara/main/__pycache__/urls.cpython-312.pyc | Bin 0 -> 365 bytes sahara/main/__pycache__/views.cpython-312.pyc | Bin 0 -> 376 bytes sahara/main/admin.py | 3 + sahara/main/apps.py | 6 + sahara/main/creds.txt | 2 + sahara/main/migrations/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 156 bytes sahara/main/models.py | 32 +++++ sahara/main/tests.py | 3 + sahara/main/urls.py | 7 + sahara/main/views.py | 7 + sahara/manage.py | 22 +++ sahara/sahara/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 147 bytes .../__pycache__/settings.cpython-312.pyc | Bin 0 -> 2745 bytes .../sahara/__pycache__/urls.cpython-312.pyc | Bin 0 -> 1087 bytes .../sahara/__pycache__/wsgi.cpython-312.pyc | Bin 0 -> 397 bytes sahara/sahara/asgi.py | 16 +++ sahara/sahara/settings.py | 134 ++++++++++++++++++ sahara/sahara/urls.py | 23 +++ sahara/sahara/wsgi.py | 6 + 29 files changed, 267 insertions(+) create mode 100644 .gitignore create mode 100644 requirements.txt create mode 100644 sahara/db.sqlite3 create mode 100644 sahara/main/__init__.py create mode 100644 sahara/main/__pycache__/__init__.cpython-312.pyc create mode 100644 sahara/main/__pycache__/admin.cpython-312.pyc create mode 100644 sahara/main/__pycache__/apps.cpython-312.pyc create mode 100644 sahara/main/__pycache__/models.cpython-312.pyc create mode 100644 sahara/main/__pycache__/urls.cpython-312.pyc create mode 100644 sahara/main/__pycache__/views.cpython-312.pyc create mode 100644 sahara/main/admin.py create mode 100644 sahara/main/apps.py create mode 100644 sahara/main/creds.txt create mode 100644 sahara/main/migrations/__init__.py create mode 100644 sahara/main/migrations/__pycache__/__init__.cpython-312.pyc create mode 100644 sahara/main/models.py create mode 100644 sahara/main/tests.py create mode 100644 sahara/main/urls.py create mode 100644 sahara/main/views.py create mode 100644 sahara/manage.py create mode 100644 sahara/sahara/__init__.py create mode 100644 sahara/sahara/__pycache__/__init__.cpython-312.pyc create mode 100644 sahara/sahara/__pycache__/settings.cpython-312.pyc create mode 100644 sahara/sahara/__pycache__/urls.cpython-312.pyc create mode 100644 sahara/sahara/__pycache__/wsgi.cpython-312.pyc create mode 100644 sahara/sahara/asgi.py create mode 100644 sahara/sahara/settings.py create mode 100644 sahara/sahara/urls.py create mode 100644 sahara/sahara/wsgi.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f5e96db --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +venv \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..866a5d8 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +asgiref==3.8.1 +Django==5.1.4 +pillow==11.1.0 +sqlparse==0.5.3 +tzdata==2024.2 diff --git a/sahara/db.sqlite3 b/sahara/db.sqlite3 new file mode 100644 index 0000000..e69de29 diff --git a/sahara/main/__init__.py b/sahara/main/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sahara/main/__pycache__/__init__.cpython-312.pyc b/sahara/main/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..606284590e8937fa53dc6fed6df81a0d77f453a5 GIT binary patch literal 145 zcmX@j%ge<81YbFu(n0iN5P=Rpvj9b=GgLBYGWxA#C}INgK7-W!GH|hq@o{o>i}6TI z&Q2`J$j^%jPRvLwN{lInP`Qbjc`@4;{!7zBjY^=g(5Z} F2LPTCE}Z}X literal 0 HcmV?d00001 diff --git a/sahara/main/__pycache__/apps.cpython-312.pyc b/sahara/main/__pycache__/apps.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3a5ab1a7aa6112db2184a4e8f0d54af78c71cfc6 GIT binary patch literal 447 zcmXv~Jxc>Y5S_WZNIpe_2q`RVgaf%+M1*`8Ei{eYaj>k}%jNXGyvr4_Q}P4ECci=a zDK?hjz{<)_h-p%}dwWhX^WM&TyR-A&XjFm6s`BK#@cJdlf0PQaJm6ps3>bRgqlpL# zoC8y4z*HOGRH-wSsiv2{1<^69w4J@bZ>3!H^w={4Gg!2aKD6CMZTqnoi<7)R(ABI~{6m;yu`p?`3zQ2tIa-%bZ(=Bp^7R2wo{bEse;47LRl@|!7N#?$?TfO zC1UocXEr#7D@V*f@Ut9p`8roX12ZDyNe&SKv7GJ-VmtEqFQNAy&SlTY6JUe_=99i$(Sf&W1UYC$PogNOr5Cjq_EB9ob z8YOGB*r9XgppPLP4T5=0?vpjA`)#v8_P8AGh5_RqyiKaFm^gLxO)CA((zV%4cIi8% zct^2TE5_1-vZ^p;$#h?3MKhM%14*sd?4T^07L(;o0mDmmT9{H3H&!R@{`jNX!`h3` zxg(4sCxz{hEE`Ih%Ca4iWuU6+=nJxZx2ovw2*XX-;W=12t5IELywlFpdzRC-!x+1) zQnSeVVQ7!AD7=`6CU9)fF(oh$NSnW~HQnMbH24cUtjS-jr`yrd?LaF!+K7(6jE>jm zk9?f}yvu^~-pX>f5T`vKlV$2ZJ+DsoI~7w1I@!ml-+8*(4?76V_&bm4RlNtkeTW60 z0`K6?xvgG{IMsg;=w5)n|3C&0LS07D!Hx8Cxjw8L?$&SAL5-h+iX8A=RP2K&p$8Rr zP@kQ`)psCvxe_0RI_scPr*QSF(StMHU7mArU%ij(W?;}kOuvtyLm$X+4DR=FhKJQS z+};s&ppdL3q_cKtRxv3mi0!L_l{|L1Vn7Y+)S|Y)sIFL4b*@Gp#(YLq*KPl@t{8U? zF-XbFhT+99EevJu5Gx;$fvTb1tx~5?;@BAUZpN$YdPPyqFN&I_ZBoNr)z;z4huv=3 zs%#E)5tLclidKZx%`9MoDqT^kx~27h3Tt4I!5WU>s9H(0Oj}fGQ7bFDysj%nY621a=dMrLeh>C&f zichP5tkFOAA~fb)Z`)5n#Ppmr%FY0aA(X|@IHJ>c!=U*J7*}}Un?&s3+|0t)@@0LlEskuhw8W8yII@#|>iaF$6w~!9?Zm|PVk@IBr(!tLrCskdUm%d%mBM6VPsN6lwOKc5EDOy`y6WULqF$t7oXhTyZwBs z$uHK^e|tFp_#cU(A9LkN-{Rvit4)md(Nv`1v-c!2IRqIPMi0dPSyQhy2|6t?5UXA6|YH92kM2Lb{|^Dz3GiRt*Bk-> literal 0 HcmV?d00001 diff --git a/sahara/main/__pycache__/urls.cpython-312.pyc b/sahara/main/__pycache__/urls.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2af993b875ad1ad9c9c340c9776538bd42cc1132 GIT binary patch literal 365 zcmXv|Jxc>Y5S_i<`-mYbX>CNYIFOVUA{G)Qh1dud$2DtqNltI~!d{}JG*$kAww9v* z!5?62wGb?<(nZpxa@NEtX5M=<^JYG3wKc$auZ}v;Sic?l4}S&bO$3i1K#&|1NeFS+ z%RNOCs#wC1Q^9gy1xY}_14)H10};H1uXO3rAxSul;>y&~m{^|+mFd{CtjGIZ8)mwl z4}_eOWjpE?N?v91-hyQg;|kMU$%{C$>*9v%PSI!=x^J>;<4)M>N*tKHGz=BvzPJ7z znv^E|8^Io4>r11{7nq|2i~Z(ddVX?xmbQ5N7C$L;dda)o@U&bO#WS5c(?)N&h>lbt v2Dv;obzFA8mb;i{ln^q3?JwAyz}8Oyeq~%Ax1J6@+0Kl58{R|JY~tK6DTZL8 literal 0 HcmV?d00001 diff --git a/sahara/main/__pycache__/views.cpython-312.pyc b/sahara/main/__pycache__/views.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c232a21821257f0068093b9a0c830aaf5a4a6926 GIT binary patch literal 376 zcmX@j%ge<81kKz{=`(=zV-N=hn4pZ$Qb5LZh7^Vr#vF!R#wf;IrYI&xh7_h2hA8Gr zW=)otAcdMtx7dnO^HNfaZt-}OloSM|78m5_6{jXMLX81Y%uxJU0?3%oPy&}rVO$Mm z2Lny=s}i!wFtqc?&rMYbNK8+)(FgK08H-qex-=PYu@|KlmZlb$6oa%V{L*!?it%xB zb&K&xOwLX$$;i)(2~NyNEJ}m+96;@CKwQiR zBpMj*aEo7%(7DX5dx1swGf;%VPm|@AKuT6(UV6S>aYlYoNpfjPaS_N5V3&aPuVg6V s1PQPMiC-Kxx%nxjIjMFi}6TI z&Q2`J$j^%jPRvLwN{lInP`Qbjc`><}=|zbpnfZCeG4b)4d6^~g@p=W7zc_4i^HWN5 ZQtgUZfo3rRaWRPTk(rT^v4|PS0syUACUF1& literal 0 HcmV?d00001 diff --git a/sahara/main/models.py b/sahara/main/models.py new file mode 100644 index 0000000..c1611fc --- /dev/null +++ b/sahara/main/models.py @@ -0,0 +1,32 @@ +from django.db import models +from django.contrib.auth.models import User + +# Create your models here. + +class Role(models.Model): + role = models.CharField(max_length=20) + role_desc = models.TextField() + + def __str__(self): + return self.role + + +class BaseUser(models.Model): + user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="user") + image = models.ImageField() + bio = models.TextField(null=True, blank=True) + address = models.CharField(null=True, blank=True, max_length=50) + contact_number = models.CharField(unique=True, max_length=15) + email = models.EmailField(unique=True) + citizenship = models.FileField(upload_to ='uploads/citizenship') + certificate = models.FileField(upload_to='uploads/certificates') + is_activated = models.BooleanField(default=False) + is_verified = models.BooleanField(default=False) + price = models.DecimalField(max_digits=9999,decimal_places=2) + ratings = models.PositiveIntegerField() + role = models.ForeignKey(Role, on_delete=models.CASCADE, related_name="user_role") + def __str__(self): + return self.user.username + USERNAME_FIELD = "email" + + diff --git a/sahara/main/tests.py b/sahara/main/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/sahara/main/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/sahara/main/urls.py b/sahara/main/urls.py new file mode 100644 index 0000000..95d2499 --- /dev/null +++ b/sahara/main/urls.py @@ -0,0 +1,7 @@ +from django.contrib import admin +from django.urls import path, include +from .views import homeView + +urlpatterns = [ + path('',homeView, name="home"), +] diff --git a/sahara/main/views.py b/sahara/main/views.py new file mode 100644 index 0000000..eb227f9 --- /dev/null +++ b/sahara/main/views.py @@ -0,0 +1,7 @@ +from django.shortcuts import render,HttpResponse + + +# Create your views here. + +def homeView(request): + return HttpResponse("

Home Page

") \ No newline at end of file diff --git a/sahara/manage.py b/sahara/manage.py new file mode 100644 index 0000000..62f9907 --- /dev/null +++ b/sahara/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sahara.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/sahara/sahara/__init__.py b/sahara/sahara/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sahara/sahara/__pycache__/__init__.cpython-312.pyc b/sahara/sahara/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ded5f6ccf85d46894b4468373b42f2dfea0ddd44 GIT binary patch literal 147 zcmX@j%ge<81i9ZD(?RrO5P=Rpvj9b=GgLBYGWxA#C}INgK7-W!GIFts@o{o>i}6TI z&Q2`J$j^%jPRvLwN{lH+q2l8+^D;}~7fB1(ky$5B11L?aB2;MgP3@t^I? zupez7g_G^1JvnZ|PkS~oRUzYuaB`nJQ z6a(En$}6YPDOA8oG~q!kX!55BVU+?pjf$Xk8chZ5nV_8}Y$v8np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uonM5%iDiiX4 zTADuK%Ac*=7^tYIeSYW9JlSd z&QESgu*OrG~Mu-_yorun|7ZZoU*`|8&8``LU+ROypE-sNiA zK-QXK&n=bVwoY3jmN>JtrmQt}&Y!`B`VB6_`4seuVW?gj zz)SZo8*79`lLX)6*VJ}BV`5D`&T58XoSO@V^$P-H@jJM6J_GFL!HvV!1%-WV-N=hSfGs0aX`j&h7^Vr#vFzy5Y3dsn9CH!#K@4!ki`a5 zj-azR5o{PMg*k;~H4}u#$iT#q%Cs6P6~$V~sLA>g#Pic+yd{#JS`uGgoSqq5&medF z(sQwj@o{o>i}6TI&Q2`J$j^%j23r&Zu@6RpjMgit{Ka9Do1apelWJGQ3)IdC#KoFG z;sY}yBjarb&bthT4;Yx*xf;2yGl*Vf5WOI#cfr8%3WL)_KBdciDvjJl+(6X;5sqbF literal 0 HcmV?d00001 diff --git a/sahara/sahara/asgi.py b/sahara/sahara/asgi.py new file mode 100644 index 0000000..1274027 --- /dev/null +++ b/sahara/sahara/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for sahara project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sahara.settings') + +application = get_asgi_application() diff --git a/sahara/sahara/settings.py b/sahara/sahara/settings.py new file mode 100644 index 0000000..7fd8178 --- /dev/null +++ b/sahara/sahara/settings.py @@ -0,0 +1,134 @@ +""" +Django settings for sahara project. + +Generated by 'django-admin startproject' using Django 5.1.4. + +For more information on this file, see +https://docs.djangoproject.com/en/5.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/5.1/ref/settings/ +""" + +from pathlib import Path +import os + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-^huq1^)wu+)bo*m#&l_4w6e&oi%iyn+^5%o4kt1zim(!!&an&y' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = ["*"] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + "main", +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'sahara.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'sahara.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/5.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/5.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/5.1/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +STATIC_URL = '/static/' +#STATICFILES_DIRS = [BASE_DIR / "static"] +STATIC_ROOT = os.path.join(BASE_DIR, 'static') + +MEDIA_URL = "/media/" +MEDIA_ROOT = BASE_DIR / "media" + + diff --git a/sahara/sahara/urls.py b/sahara/sahara/urls.py new file mode 100644 index 0000000..df9e25a --- /dev/null +++ b/sahara/sahara/urls.py @@ -0,0 +1,23 @@ +""" +URL configuration for sahara project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/5.1/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path, include + +urlpatterns = [ + path('admin/', admin.site.urls), + path('',include("main.urls")) +] diff --git a/sahara/sahara/wsgi.py b/sahara/sahara/wsgi.py new file mode 100644 index 0000000..3e4f48e --- /dev/null +++ b/sahara/sahara/wsgi.py @@ -0,0 +1,6 @@ +import os +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sahara.settings') + +application = get_wsgi_application()