diff --git a/.gitignore b/.gitignore index b7faf40..45a7a7b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # Byte-compiled / optimized / DLL files +labEnv/ __pycache__/ *.py[codz] *$py.class diff --git a/GoogleSearch/GoogleSearch/__init__.py b/GoogleSearch/GoogleSearch/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/GoogleSearch/GoogleSearch/asgi.py b/GoogleSearch/GoogleSearch/asgi.py new file mode 100644 index 0000000..07cf612 --- /dev/null +++ b/GoogleSearch/GoogleSearch/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for GoogleSearch 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/6.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'GoogleSearch.settings') + +application = get_asgi_application() diff --git a/GoogleSearch/GoogleSearch/settings.py b/GoogleSearch/GoogleSearch/settings.py new file mode 100644 index 0000000..3a4936e --- /dev/null +++ b/GoogleSearch/GoogleSearch/settings.py @@ -0,0 +1,124 @@ +""" +Django settings for GoogleSearch project. + +Generated by 'django-admin startproject' using Django 6.0.3. + +For more information on this file, see +https://docs.djangoproject.com/en/6.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/6.0/ref/settings/ +""" + +from pathlib import Path + +# 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/6.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-7b08fu_g%3rk!3yj&599u*z_n0@5!t)*0utj4c99!dyu&p5b-l' + +# 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.locale.LocaleMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'GoogleSearch.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'GoogleSearch.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/6.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/6.0/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/6.0/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True +LANGUAGES = [ + ('en', 'English'), + ('ar', 'Arabic'), +] +LANGUAGE_BIDI = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/6.0/howto/static-files/ + +STATIC_URL = 'static/' diff --git a/GoogleSearch/GoogleSearch/urls.py b/GoogleSearch/GoogleSearch/urls.py new file mode 100644 index 0000000..841c278 --- /dev/null +++ b/GoogleSearch/GoogleSearch/urls.py @@ -0,0 +1,23 @@ +""" +URL configuration for GoogleSearch project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/6.0/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/GoogleSearch/GoogleSearch/wsgi.py b/GoogleSearch/GoogleSearch/wsgi.py new file mode 100644 index 0000000..48684be --- /dev/null +++ b/GoogleSearch/GoogleSearch/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for GoogleSearch project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/6.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'GoogleSearch.settings') + +application = get_wsgi_application() diff --git a/GoogleSearch/main/__init__.py b/GoogleSearch/main/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/GoogleSearch/main/admin.py b/GoogleSearch/main/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/GoogleSearch/main/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/GoogleSearch/main/apps.py b/GoogleSearch/main/apps.py new file mode 100644 index 0000000..833bff6 --- /dev/null +++ b/GoogleSearch/main/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class MainConfig(AppConfig): + name = 'main' diff --git a/GoogleSearch/main/migrations/__init__.py b/GoogleSearch/main/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/GoogleSearch/main/models.py b/GoogleSearch/main/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/GoogleSearch/main/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/GoogleSearch/main/static/css/style.css b/GoogleSearch/main/static/css/style.css new file mode 100644 index 0000000..513dd27 --- /dev/null +++ b/GoogleSearch/main/static/css/style.css @@ -0,0 +1,356 @@ +/* I need to know why we reset... */ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} +body { + font-family: sans-serif; + background-color: #fff; +} +body.dark { + background-color: #1f1f1f; +} +/* wrapper Styles */ +.wrapper { + + display: flex; + flex-direction: column; + min-height: 100vh; +} + + +/* nav Styles */ +nav { + padding: 0.5rem 0.5rem; + display: flex; + flex-direction: row; + align-items: center; + justify-content: right; + font-family: sans-serif; + font-size: 0.8rem; + gap: 0.8rem; +} +nav a { + text-decoration: none; + color: #5b7183; + +} +body.dark nav a { + color: #e8eaed; +} +nav a:hover { + text-decoration: underline; +} +nav span { + color: #5b7183; + padding: 0.4rem; +} +body.dark nav span { + color: #e8eaed; +} +nav .apps-btn { + border: none; + background: none; + cursor: pointer; +} +nav .apps-btn:hover{ + border: none; + + background-color: gray; + border-radius: 50%; +} + +nav .btn { + background-color: #0957d0; + color: white; + border: none; + font-size: 0.9rem; + padding: 0.7rem 1.3rem; + border-radius: 2rem; +} +nav .btn:hover { + box-shadow: #5b7183 0px 0px 5px; + cursor: pointer; +} + +/* footer Styles */ +footer { + display: flex; + flex-direction: column; + margin-top: auto; /* makes it stuck to bootom */ + font-family: sans-serif; + font-size: 0.8rem; + color: #5b7183; + background-color: #f2f2f2; +} +body.dark footer , body.dark footer a { + background-color: #171717; + color: #e8eaed; +} +footer .top-section { + padding: 1rem 2rem; + font-size: 0.9rem; + text-decoration: none; + display: flex; + flex-direction: row; + justify-content: space-between; +} +footer .line { + border-top: 1px solid #e0e0e0; +} +footer .bottom-section { + padding: 0.9rem 2.1rem; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + font-size: 0.85rem; + gap: 1.2rem; + flex-wrap: wrap; +} +footer .right { + display: flex; + flex-direction: row; + gap: 1.5rem; +} +footer .left { + display: flex; + flex-direction: row; + gap: 1.5rem; +} +footer a { + text-decoration: none; + color: #5b7183; +} + +/* main Styles -- google search page */ +main { + display: flex; + flex-direction: column; + align-items: center; + gap: 1rem; + font-family: sans-serif; + font-size: 0.8rem; +} +main .main-top img{ + width: 273px; + height: auto; + margin-top: 8rem; + margin-bottom: 1rem; +} +main .main-middle .search-box { + display: flex; + flex-direction: row; + align-items: center; + box-shadow: #5b7183 0rem 0rem 0.1rem; + border-radius: 2rem; + width: 37rem; + height: 3rem; + padding: 0.5rem 0.5rem; + gap: 0.5rem; +} +body.dark main .main-middle .search-box { + background-color: #4d5156; + box-shadow: #e8eaed 0rem 0rem 0.1rem; +} +.search-form { + display: flex; + flex-direction: column; + align-items: center; +} +main .main-middle input{ + width: 30rem; + height: 2rem; + border: none; + background-color: none; +} +body.dark main .main-middle input { + background-color: #4d5156; + color: #e8eaed; +} +main .main-middle input:focus { + outline: none; +} +main .main-middle .search-box button{ + max-width: 1.9em; + max-height: 1.9rem; + border: none; + border-radius: 2rem; + background-color: transparent; +} +main .main-middle .search-box button:hover{ + cursor: pointer; +} +main .main-middle .search-box img{ + max-width: 100%; + max-height: 100%; + border-radius: 2rem; +} +body.dark main .main-middle .search-box img { + background-color: transparent; +} +.buttons { + display: flex; + flex-direction: row; + gap: 1rem; + margin-top: 1.5rem; + align-items: center; + justify-content: center; +} +.buttons button, +.buttons a { + background-color: #f8f8f8; + color: #5b7183; + border: none; + padding: 0.7rem 1.3rem; + border-radius: 0.7rem; + text-decoration: none; +} +body.dark .buttons button, +body.dark .buttons a { + background-color: #3c4043; + color: #e8eaed; +} +.buttons button:hover, +.buttons a:hover { + box-shadow: black 0px 0px 5px; + cursor: pointer; +} +body.dark .buttons button:hover, +body.dark .buttons a:hover { + box-shadow: #e8eaed 0px 0px 2px; +} +main .main-bottom { + font-family: sans-serif; + font-size: 0.9rem; + text-decoration: none; + color: #5b7183; + margin-top: 3rem; +} +body.dark main .main-bottom { + color: #e8eaed; +} + +main .main-bottom a { + text-decoration: none; +} +main .main-bottom a:hover { + text-decoration: underline; + cursor: pointer; +} +.terms-wrapper { + display: flex; + flex-direction: column; + align-items: center; + width: 100%; + max-width: 980px; + margin: 0 auto; + padding: 3rem 1.5rem 5rem; + font-family: sans-serif; + font-size: 1rem; + text-align: left; +} +.terms-wrapper img { + width: 100%; + max-width: 100%; + margin-bottom: 2rem; +} +.terms-content { + width: 100%; + max-width: 100%; +} +.terms-content h1 { + font-size: 2.2rem; + font-weight: 500; + color: #202124; + margin-bottom: 1rem; +} +body.dark .terms-content h1, body.dark .terms-content h2, body.dark .terms-content h3, body.dark .terms-content h4 { + color: #e8eaed; +} +.terms-content h2 { + font-size: 1.75rem; + font-weight: 500; + color: #202124; + margin: 2.5rem 0 1rem; +} +.terms-content h3 { + font-size: 1.25rem; + font-weight: 600; + color: #202124; + margin: 1.75rem 0 0.75rem; +} +.terms-content h4 { + font-size: 1rem; + font-weight: 600; + color: #202124; + margin: 1.75rem 0 0.75rem; +} +.terms-content p, +.terms-content li { + color: #3c4043; + line-height: 1.8; +} +body.dark .terms-content p, +body.dark .terms-content li { + color: #e8eaed; +} +.terms-content p { + margin-bottom: 1rem; +} +.terms-content ul { + padding-left: 1.5rem; + margin: 1rem 0 1.5rem; +} +.terms-content li { + margin-bottom: 0.6rem; +} +.terms-content a { + color: #1a73e8; + text-decoration: none; +} +.terms-content a:hover { + text-decoration: underline; +} +.terms-meta { + color: #5f6368; + font-size: 0.95rem; +} +body.dark .terms-meta { + color: #e8eaed; +} +footer .top-section .display-mode { + display: flex; + flex-direction: row; + gap: 1rem; + align-items: center; +} +footer .top-section .display-mode .dark-mode-toggle { + background-color: transparent; + border: none; + cursor: pointer; +} +footer .top-section .display-mode .light-mode-toggle { + background-color: #202124; + color: #e8eaed; + padding: 0.2rem 0.25rem 0.1rem 0.25em; + border-radius: 50%; + border: none; + cursor: pointer; +} +body.dark footer .top-section .display-mode .dark-mode-toggle { + background-color: #e8eaed; + color: #202124; + padding: 0.2rem 0.25rem 0.1rem 0.25em; + border-radius: 50%; + border: none; + cursor: pointer; +} +body.dark footer .top-section .display-mode .light-mode-toggle { + background-color: transparent; + border: none; + cursor: pointer; +} + + diff --git a/GoogleSearch/main/static/images/camera.png b/GoogleSearch/main/static/images/camera.png new file mode 100644 index 0000000..4ecc705 Binary files /dev/null and b/GoogleSearch/main/static/images/camera.png differ diff --git a/GoogleSearch/main/static/images/google-logo.png b/GoogleSearch/main/static/images/google-logo.png new file mode 100644 index 0000000..ed8841b Binary files /dev/null and b/GoogleSearch/main/static/images/google-logo.png differ diff --git a/GoogleSearch/main/static/images/mircophone.png b/GoogleSearch/main/static/images/mircophone.png new file mode 100644 index 0000000..adbf033 Binary files /dev/null and b/GoogleSearch/main/static/images/mircophone.png differ diff --git a/GoogleSearch/main/static/images/tos_main_illustration.svg b/GoogleSearch/main/static/images/tos_main_illustration.svg new file mode 100644 index 0000000..883e2d6 --- /dev/null +++ b/GoogleSearch/main/static/images/tos_main_illustration.svg @@ -0,0 +1 @@ +scene_password_manager_welcome diff --git a/GoogleSearch/main/templates/main/base.html b/GoogleSearch/main/templates/main/base.html new file mode 100644 index 0000000..bf54972 --- /dev/null +++ b/GoogleSearch/main/templates/main/base.html @@ -0,0 +1,53 @@ + + + + {% load static %} + + + + + {% block title %}{% endblock %} + + +
+ +
+ {% block content %} + + {% endblock %} +
+ +
+ + diff --git a/GoogleSearch/main/templates/main/home.html b/GoogleSearch/main/templates/main/home.html new file mode 100644 index 0000000..95c71ff --- /dev/null +++ b/GoogleSearch/main/templates/main/home.html @@ -0,0 +1,33 @@ +{% extends "main/base.html" %} +{% load static %} +{% block title %}Google{% endblock %} +{% block content %} +
+ Google Logo +
+
+
+ +
+ + I'm Feeling Lucky +
+
+
+ +
+
Google offered in: العربية
+
+ +{% endblock %} diff --git a/GoogleSearch/main/templates/main/terms.html b/GoogleSearch/main/templates/main/terms.html new file mode 100644 index 0000000..e2f9d0e --- /dev/null +++ b/GoogleSearch/main/templates/main/terms.html @@ -0,0 +1,79 @@ +{% extends 'main/base.html' %} +{% load static %} + +{% block title %}Google Terms{% endblock %} + +{% block content %} +
+ Terms of Service + +
+

Google Terms of Service

+

+ Effective 5 January 2022 | + Archived versions | + Download PDF +

+

+ Country version: + Saudi Arabia +

+ +

What's covered in these terms

+

+ We know it's tempting to skip these Terms of Service, but it's important to establish what you can + expect from us as you use Google services, and what we expect from you. +

+

+ These Terms of Service reflect the way that Google's business works, the laws that apply to our company, + and certain things that we've always believed to be true. As a result, these terms help define Google's + relationship with you as you interact with its services. +

+ + + +

+ Understanding these terms is important because, by using our services, you’re agreeing to these terms. +

+

+ Besides these terms, we also publish a + Privacy Policy + . Although it’s not part of these terms, we encourage you to read it to better understand how you can + update, manage, export and delete your information. +

+ +

Terms

+ +

Service provider

+

+ Google services are provided by, and you’re contracting with: +

+

+ Google LLC
+ organised under the laws of the State of Delaware, USA, and operating under the laws of the US

+ 1600 Amphitheatre Parkway
+ Mountain View, California 94043
+ USA +

+ +

Age requirements

+

+ If you’re under the + age required to manage your own Google Account, you must have your parent or legal guardian’s permission to use a Google Account. Please ask your parent or legal guardian to read these terms with you. +

+

+ If you’re a parent or legal guardian, and you allow your child to use the + services, then these terms apply to you and you’re responsible for your child’s activity on the services. +

+

+ Some Google services have additional age requirements as described in their + service-specific additional terms and policies. +

+
+
+{% endblock %} \ No newline at end of file diff --git a/GoogleSearch/main/tests.py b/GoogleSearch/main/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/GoogleSearch/main/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/GoogleSearch/main/urls.py b/GoogleSearch/main/urls.py new file mode 100644 index 0000000..f922315 --- /dev/null +++ b/GoogleSearch/main/urls.py @@ -0,0 +1,10 @@ +from django.urls import path +from . import views + +app_name = 'main' + +urlpatterns = [ + path('', views.home_view, name='home_view'), + path('terms/', views.terms_view, name='terms_view'), + path('mode//', views.mode_view, name='mode_view'), +] \ No newline at end of file diff --git a/GoogleSearch/main/views.py b/GoogleSearch/main/views.py new file mode 100644 index 0000000..b3ce1e4 --- /dev/null +++ b/GoogleSearch/main/views.py @@ -0,0 +1,20 @@ +from django.shortcuts import render, redirect +from django.http import HttpResponse, HttpRequest + + + + +def home_view(request: HttpRequest): + return render(request, 'main/home.html') + +def terms_view(request): + return render(request, 'main/terms.html') + +def mode_view(request:HttpRequest, mode): + response = redirect(request.GET.get("next", "/")) + if mode == "light": + response.set_cookie("mode", "light") + elif mode == "dark": + response.set_cookie("mode", "dark") + return response + diff --git a/GoogleSearch/manage.py b/GoogleSearch/manage.py new file mode 100755 index 0000000..cad9c4a --- /dev/null +++ b/GoogleSearch/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', 'GoogleSearch.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()