From 694790167dcb34b04ac6eca37e84ff51c7ff988b Mon Sep 17 00:00:00 2001 From: Amarachukwu Whitson-Akpamgbo Date: Mon, 6 Jan 2025 11:37:25 -0800 Subject: [PATCH] Initial commit --- .gitignore | 4 + src/feeling/__init__.py | 0 src/feeling/admin.py | 3 + src/feeling/apps.py | 6 + src/feeling/migrations/0001_initial.py | 24 ++++ src/feeling/migrations/__init__.py | 0 src/feeling/models.py | 9 ++ src/feeling/tests.py | 3 + src/feeling/views.py | 3 + src/imagine/__init__.py | 0 src/imagine/admin.py | 5 + src/imagine/apps.py | 6 + src/imagine/migrations/0001_initial.py | 24 ++++ .../migrations/0002_alter_product_summary.py | 18 +++ src/imagine/migrations/__init__.py | 0 src/imagine/models.py | 7 + src/imagine/tests.py | 3 + src/imagine/views.py | 3 + src/manage.py | 22 +++ src/tryDjango/__init__.py | 0 src/tryDjango/asgi.py | 16 +++ src/tryDjango/manage.py | 22 +++ src/tryDjango/settings.py | 125 ++++++++++++++++++ src/tryDjango/tryDjango/__init__.py | 0 src/tryDjango/tryDjango/asgi.py | 16 +++ src/tryDjango/tryDjango/settings.py | 124 +++++++++++++++++ src/tryDjango/tryDjango/urls.py | 22 +++ src/tryDjango/tryDjango/wsgi.py | 16 +++ src/tryDjango/urls.py | 22 +++ src/tryDjango/wsgi.py | 16 +++ 30 files changed, 519 insertions(+) create mode 100644 .gitignore create mode 100644 src/feeling/__init__.py create mode 100644 src/feeling/admin.py create mode 100644 src/feeling/apps.py create mode 100644 src/feeling/migrations/0001_initial.py create mode 100644 src/feeling/migrations/__init__.py create mode 100644 src/feeling/models.py create mode 100644 src/feeling/tests.py create mode 100644 src/feeling/views.py create mode 100644 src/imagine/__init__.py create mode 100644 src/imagine/admin.py create mode 100644 src/imagine/apps.py create mode 100644 src/imagine/migrations/0001_initial.py create mode 100644 src/imagine/migrations/0002_alter_product_summary.py create mode 100644 src/imagine/migrations/__init__.py create mode 100644 src/imagine/models.py create mode 100644 src/imagine/tests.py create mode 100644 src/imagine/views.py create mode 100644 src/manage.py create mode 100644 src/tryDjango/__init__.py create mode 100644 src/tryDjango/asgi.py create mode 100644 src/tryDjango/manage.py create mode 100644 src/tryDjango/settings.py create mode 100644 src/tryDjango/tryDjango/__init__.py create mode 100644 src/tryDjango/tryDjango/asgi.py create mode 100644 src/tryDjango/tryDjango/settings.py create mode 100644 src/tryDjango/tryDjango/urls.py create mode 100644 src/tryDjango/tryDjango/wsgi.py create mode 100644 src/tryDjango/urls.py create mode 100644 src/tryDjango/wsgi.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..180f665a29 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# Created by venv; see https://docs.python.org/3/library/venv.html +pyvenv.cfg +*.pyc +db.sqlite3 \ No newline at end of file diff --git a/src/feeling/__init__.py b/src/feeling/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/feeling/admin.py b/src/feeling/admin.py new file mode 100644 index 0000000000..8c38f3f3da --- /dev/null +++ b/src/feeling/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/src/feeling/apps.py b/src/feeling/apps.py new file mode 100644 index 0000000000..2666ab31d4 --- /dev/null +++ b/src/feeling/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class FeelingConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'feeling' diff --git a/src/feeling/migrations/0001_initial.py b/src/feeling/migrations/0001_initial.py new file mode 100644 index 0000000000..fcb974decb --- /dev/null +++ b/src/feeling/migrations/0001_initial.py @@ -0,0 +1,24 @@ +# Generated by Django 5.1.4 on 2024-12-10 02:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Product', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.TextField()), + ('description', models.TextField()), + ('price', models.TextField()), + ('summary', models.TextField()), + ], + ), + ] diff --git a/src/feeling/migrations/__init__.py b/src/feeling/migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/feeling/models.py b/src/feeling/models.py new file mode 100644 index 0000000000..6c0d91e0c8 --- /dev/null +++ b/src/feeling/models.py @@ -0,0 +1,9 @@ +from django.db import models + +# Create your from django.db import models + +class Product(models.Model): + title = models.TextField() + description = models.TextField() + price = models.TextField() + summary = models.TextField() diff --git a/src/feeling/tests.py b/src/feeling/tests.py new file mode 100644 index 0000000000..7ce503c2dd --- /dev/null +++ b/src/feeling/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/src/feeling/views.py b/src/feeling/views.py new file mode 100644 index 0000000000..91ea44a218 --- /dev/null +++ b/src/feeling/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/src/imagine/__init__.py b/src/imagine/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/imagine/admin.py b/src/imagine/admin.py new file mode 100644 index 0000000000..9c3c54f95f --- /dev/null +++ b/src/imagine/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin + +from .models import Product + +admin.site.register(Product) \ No newline at end of file diff --git a/src/imagine/apps.py b/src/imagine/apps.py new file mode 100644 index 0000000000..55872b8351 --- /dev/null +++ b/src/imagine/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ImagineConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'imagine' diff --git a/src/imagine/migrations/0001_initial.py b/src/imagine/migrations/0001_initial.py new file mode 100644 index 0000000000..267b819dc3 --- /dev/null +++ b/src/imagine/migrations/0001_initial.py @@ -0,0 +1,24 @@ +# Generated by Django 5.1.4 on 2024-12-10 02:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Product', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.TextField()), + ('description', models.TextField()), + ('price', models.TextField()), + ('summary', models.TextField(default='bruh')), + ], + ), + ] diff --git a/src/imagine/migrations/0002_alter_product_summary.py b/src/imagine/migrations/0002_alter_product_summary.py new file mode 100644 index 0000000000..f4715de952 --- /dev/null +++ b/src/imagine/migrations/0002_alter_product_summary.py @@ -0,0 +1,18 @@ +# Generated by Django 5.1.4 on 2024-12-10 03:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('imagine', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='product', + name='summary', + field=models.TextField(default='I love tacobell'), + ), + ] diff --git a/src/imagine/migrations/__init__.py b/src/imagine/migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/imagine/models.py b/src/imagine/models.py new file mode 100644 index 0000000000..fbc204cf68 --- /dev/null +++ b/src/imagine/models.py @@ -0,0 +1,7 @@ +from django.db import models + +class Product(models.Model): + title = models.TextField() + description = models.TextField() + price = models.TextField() + summary = models.TextField(default='I love tacobell') diff --git a/src/imagine/tests.py b/src/imagine/tests.py new file mode 100644 index 0000000000..7ce503c2dd --- /dev/null +++ b/src/imagine/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/src/imagine/views.py b/src/imagine/views.py new file mode 100644 index 0000000000..91ea44a218 --- /dev/null +++ b/src/imagine/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/src/manage.py b/src/manage.py new file mode 100644 index 0000000000..1bb4f9a5dc --- /dev/null +++ b/src/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', 'tryDjango.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/src/tryDjango/__init__.py b/src/tryDjango/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/tryDjango/asgi.py b/src/tryDjango/asgi.py new file mode 100644 index 0000000000..97fbbac870 --- /dev/null +++ b/src/tryDjango/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for tryDjango 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', 'tryDjango.settings') + +application = get_asgi_application() diff --git a/src/tryDjango/manage.py b/src/tryDjango/manage.py new file mode 100644 index 0000000000..1bb4f9a5dc --- /dev/null +++ b/src/tryDjango/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', 'tryDjango.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/src/tryDjango/settings.py b/src/tryDjango/settings.py new file mode 100644 index 0000000000..20cbfa6633 --- /dev/null +++ b/src/tryDjango/settings.py @@ -0,0 +1,125 @@ +""" +Django settings for tryDjango 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 + +# 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-*h9pyducz0g%p6xm$hjnqxj#f#=ck_w&nm9e#cc@kryctm_!pu' + +# 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', + 'imagine', + 'feeling', +] + +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 = 'tryDjango.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 = 'tryDjango.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' diff --git a/src/tryDjango/tryDjango/__init__.py b/src/tryDjango/tryDjango/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/tryDjango/tryDjango/asgi.py b/src/tryDjango/tryDjango/asgi.py new file mode 100644 index 0000000000..97fbbac870 --- /dev/null +++ b/src/tryDjango/tryDjango/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for tryDjango 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', 'tryDjango.settings') + +application = get_asgi_application() diff --git a/src/tryDjango/tryDjango/settings.py b/src/tryDjango/tryDjango/settings.py new file mode 100644 index 0000000000..574ebdad95 --- /dev/null +++ b/src/tryDjango/tryDjango/settings.py @@ -0,0 +1,124 @@ +""" +Django settings for tryDjango 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 + +# 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-zi3(=o*9r&_!u-)&o%lz=^6g4za))ancn5uqao=4eev^db342%' + +# 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', + 'imagine', +] + +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 = 'tryDjango.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 = 'tryDjango.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' diff --git a/src/tryDjango/tryDjango/urls.py b/src/tryDjango/tryDjango/urls.py new file mode 100644 index 0000000000..0e27aeeaf9 --- /dev/null +++ b/src/tryDjango/tryDjango/urls.py @@ -0,0 +1,22 @@ +""" +URL configuration for tryDjango 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 + +urlpatterns = [ + path('admin/', admin.site.urls), +] diff --git a/src/tryDjango/tryDjango/wsgi.py b/src/tryDjango/tryDjango/wsgi.py new file mode 100644 index 0000000000..cf991e1be3 --- /dev/null +++ b/src/tryDjango/tryDjango/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for tryDjango 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/5.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tryDjango.settings') + +application = get_wsgi_application() diff --git a/src/tryDjango/urls.py b/src/tryDjango/urls.py new file mode 100644 index 0000000000..0e27aeeaf9 --- /dev/null +++ b/src/tryDjango/urls.py @@ -0,0 +1,22 @@ +""" +URL configuration for tryDjango 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 + +urlpatterns = [ + path('admin/', admin.site.urls), +] diff --git a/src/tryDjango/wsgi.py b/src/tryDjango/wsgi.py new file mode 100644 index 0000000000..cf991e1be3 --- /dev/null +++ b/src/tryDjango/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for tryDjango 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/5.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tryDjango.settings') + +application = get_wsgi_application()