diff --git a/Code/shaina/2Flask_HTML_CSS/Burrito_Form/index.html b/Code/shaina/2Flask_HTML_CSS/Burrito_Form/index.html new file mode 100644 index 00000000..b74b922e --- /dev/null +++ b/Code/shaina/2Flask_HTML_CSS/Burrito_Form/index.html @@ -0,0 +1,109 @@ + + + + + + + Burrito Order Form + + + +
+

BURRITO ORDER FORM

+
+ ... +
+

Customer Information

+
+ + +
+
+ + +
+
+ +

Tortilla Selection:

+ + +
+ + + +
+ + + +
+ + +
+ +

Rice Selection:

+ + +
+ + + +
+ +

Bean Selection:

+ + +
+ + +
+ +

Protein Selection:

+ + +
+ + +
+ + +
+ + +
+ +

Additional Ingredients:

+ + + + + + +
+
+

Delivery Instructions:

+ + +
+ + + + + + \ No newline at end of file diff --git a/Code/shaina/2Flask_HTML_CSS/Company_Page/index.html b/Code/shaina/2Flask_HTML_CSS/Company_Page/index.html new file mode 100644 index 00000000..9a3b7d33 --- /dev/null +++ b/Code/shaina/2Flask_HTML_CSS/Company_Page/index.html @@ -0,0 +1,53 @@ + + + + + + + Nintendo Page + + + + + + +
+
+ ... +
+
+

Try the demo - bon appetit!

+ ... +
+
+ + + + + \ No newline at end of file diff --git a/Code/shaina/2Flask_HTML_CSS/Flask_Lecture/app.py b/Code/shaina/2Flask_HTML_CSS/Flask_Lecture/app.py new file mode 100644 index 00000000..060fac50 --- /dev/null +++ b/Code/shaina/2Flask_HTML_CSS/Flask_Lecture/app.py @@ -0,0 +1,15 @@ +from flask import Flask, render_template +app = Flask(__name__) + +# localhost:5000 +@app.route('/') +def index(): + return render_template('index.html') + +@app.route('/about') +def about(): + return render_template('about.html') + +@app.route('/contact') +def contact(): + return render_template('contact.html') \ No newline at end of file diff --git a/Code/shaina/2Flask_HTML_CSS/Flask_Lecture/templates/about.html b/Code/shaina/2Flask_HTML_CSS/Flask_Lecture/templates/about.html new file mode 100644 index 00000000..ec3d509f --- /dev/null +++ b/Code/shaina/2Flask_HTML_CSS/Flask_Lecture/templates/about.html @@ -0,0 +1,13 @@ + + + + + + + Document + + +

About Page

+ + + \ No newline at end of file diff --git a/Code/shaina/2Flask_HTML_CSS/Flask_Lecture/templates/contact.html b/Code/shaina/2Flask_HTML_CSS/Flask_Lecture/templates/contact.html new file mode 100644 index 00000000..4916f6d0 --- /dev/null +++ b/Code/shaina/2Flask_HTML_CSS/Flask_Lecture/templates/contact.html @@ -0,0 +1,13 @@ + + + + + + + Document + + +

Contact Us!

+ + + \ No newline at end of file diff --git a/Code/shaina/2Flask_HTML_CSS/Flask_Lecture/templates/index.html b/Code/shaina/2Flask_HTML_CSS/Flask_Lecture/templates/index.html new file mode 100644 index 00000000..ca44c811 --- /dev/null +++ b/Code/shaina/2Flask_HTML_CSS/Flask_Lecture/templates/index.html @@ -0,0 +1,12 @@ + + + + + + + Document + + +

Welcome to my flask app

+ + \ No newline at end of file diff --git a/Code/shaina/2Flask_HTML_CSS/Unit_Converter/Templates/index.html b/Code/shaina/2Flask_HTML_CSS/Unit_Converter/Templates/index.html new file mode 100644 index 00000000..f9eb728f --- /dev/null +++ b/Code/shaina/2Flask_HTML_CSS/Unit_Converter/Templates/index.html @@ -0,0 +1,74 @@ + + + + + + + Unit Converter + + +
+

UNIT CONVERTER

+ + + +

Select Starting Unit

+ + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+
+ +

Select Ending Unit

+ + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + +
+ + \ No newline at end of file diff --git a/Code/shaina/2Flask_HTML_CSS/Unit_Converter/Templates/results.html b/Code/shaina/2Flask_HTML_CSS/Unit_Converter/Templates/results.html new file mode 100644 index 00000000..2607305d --- /dev/null +++ b/Code/shaina/2Flask_HTML_CSS/Unit_Converter/Templates/results.html @@ -0,0 +1,14 @@ + + + + + + + Results + + +

RESULTS:

+

{{ dist }} {{ unit1 }} converts to {{ conversion }} {{ unit2 }}

+ Need to convert more units? + + \ No newline at end of file diff --git a/Code/shaina/2Flask_HTML_CSS/Unit_Converter/app.py b/Code/shaina/2Flask_HTML_CSS/Unit_Converter/app.py new file mode 100644 index 00000000..9ff50411 --- /dev/null +++ b/Code/shaina/2Flask_HTML_CSS/Unit_Converter/app.py @@ -0,0 +1,25 @@ +from flask import Flask, render_template, request +app = Flask(__name__) + +@app.route('/') +def index(): + return render_template('index.html') + +@app.route('/converter', methods=['POST']) +def converter(): + result = request.form + + unit1= result['s_unit'] + unit2= result['e_unit'] + dist = float(result['distance']) + units_to_m = { + 'ft': 0.3048, + 'mi': 1609.34, + 'm': 1, + 'km': 1000, + 'yd': 0.9144, + 'in': 0.0254 + } + conversion = round((dist * units_to_m[unit1]) * (1/units_to_m[unit2]), 4) + + return render_template('results.html',unit1=unit1, unit2=unit2, dist=dist, conversion=conversion) \ No newline at end of file diff --git a/Code/shaina/Django/Grocery/grocery_app/__init__.py b/Code/shaina/Django/Grocery/grocery_app/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/shaina/Django/Grocery/grocery_app/admin.py b/Code/shaina/Django/Grocery/grocery_app/admin.py new file mode 100644 index 00000000..1201be3a --- /dev/null +++ b/Code/shaina/Django/Grocery/grocery_app/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin +from .models import * + +# Register your models here. +admin.site.register(Department) +admin.site.register(GroceryItem) \ No newline at end of file diff --git a/Code/shaina/Django/Grocery/grocery_app/apps.py b/Code/shaina/Django/Grocery/grocery_app/apps.py new file mode 100644 index 00000000..87b0bfcb --- /dev/null +++ b/Code/shaina/Django/Grocery/grocery_app/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class GroceryAppConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'grocery_app' diff --git a/Code/shaina/Django/Grocery/grocery_app/migrations/0001_initial.py b/Code/shaina/Django/Grocery/grocery_app/migrations/0001_initial.py new file mode 100644 index 00000000..f4ad68a3 --- /dev/null +++ b/Code/shaina/Django/Grocery/grocery_app/migrations/0001_initial.py @@ -0,0 +1,31 @@ +# Generated by Django 4.0.3 on 2022-05-19 23:38 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Department', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=20)), + ], + ), + migrations.CreateModel( + name='GroceryItem', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('item', models.CharField(max_length=40)), + ('completed', models.BooleanField(default=False)), + ('department', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='items', to='grocery_app.department')), + ], + ), + ] diff --git a/Code/shaina/Django/Grocery/grocery_app/migrations/__init__.py b/Code/shaina/Django/Grocery/grocery_app/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/shaina/Django/Grocery/grocery_app/models.py b/Code/shaina/Django/Grocery/grocery_app/models.py new file mode 100644 index 00000000..5a6bb02c --- /dev/null +++ b/Code/shaina/Django/Grocery/grocery_app/models.py @@ -0,0 +1,16 @@ +from django.db import models + +# Create your models here. +class Department(models.Model): + name =models.CharField(max_length=20) + + def __str__(self): + return f'{self.name}' + +class GroceryItem(models.Model): + item =models.CharField(max_length=40) + completed = models.BooleanField(default=False) + department = models.ForeignKey(Department, on_delete=models.CASCADE, related_name='items', null=True, blank=True) + + def __str__(self): + return f'{self.item} -- {self.completed}' \ No newline at end of file diff --git a/Code/shaina/Django/Grocery/grocery_app/templates/grocery_app/index.html b/Code/shaina/Django/Grocery/grocery_app/templates/grocery_app/index.html new file mode 100644 index 00000000..70b35184 --- /dev/null +++ b/Code/shaina/Django/Grocery/grocery_app/templates/grocery_app/index.html @@ -0,0 +1,46 @@ + + + + + + + Document + + +

Grocery List

+
+ {% csrf_token %} + + + + + {% for department in departments %} +
+

{{department.name}}

+ +
+ {% endfor %} +
+ + \ No newline at end of file diff --git a/Code/shaina/Django/Grocery/grocery_app/tests.py b/Code/shaina/Django/Grocery/grocery_app/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/Code/shaina/Django/Grocery/grocery_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/Code/shaina/Django/Grocery/grocery_app/urls.py b/Code/shaina/Django/Grocery/grocery_app/urls.py new file mode 100644 index 00000000..7500d750 --- /dev/null +++ b/Code/shaina/Django/Grocery/grocery_app/urls.py @@ -0,0 +1,11 @@ +from django.urls import path +from .import views + +app_name = 'grocery_list' + +urlpatterns = [ + path('', views.index, name='index'), + path('add_item', views.add_item, name='add'), + path('buy//', views.buy_item, name='buy'), + path('delete//', views.delete_item, name='delete'), +] diff --git a/Code/shaina/Django/Grocery/grocery_app/views.py b/Code/shaina/Django/Grocery/grocery_app/views.py new file mode 100644 index 00000000..4884ae9e --- /dev/null +++ b/Code/shaina/Django/Grocery/grocery_app/views.py @@ -0,0 +1,37 @@ +from django.shortcuts import render +from .models import * + +from django.http import HttpResponseRedirect +from django.urls import reverse + +# Create your views here. +def index(request): + grocery_list = GroceryItem.objects.all().order_by('department') + departments = Department.objects.all().order_by('name') + + return render(request, 'grocery_app/index.html', { + 'grocery_list': grocery_list, + 'departments': departments + }) + +def add_item(request): + item_text = request.POST['item'] + department_id = request.POST['department'] + new_item = GroceryItem() + new_item.item = item_text + if department_id: + department = Department.objects.get(id=department_id) + new_item.department = department + new_item.save() + return HttpResponseRedirect(reverse('grocery_list:index')) + +def buy_item(request, item_id): + grocery_item = GroceryItem.objects.get(id=item_id) + grocery_item.completed = not grocery_item.completed + grocery_item.save() + return HttpResponseRedirect(reverse('grocery_list:index')) + +def delete_item(request, item_id): + grocery_item = GroceryItem.objects.get(id=item_id) + grocery_item.delete() + return HttpResponseRedirect(reverse('grocery_list:index')) \ No newline at end of file diff --git a/Code/shaina/Django/Grocery/grocery_proj/__init__.py b/Code/shaina/Django/Grocery/grocery_proj/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/shaina/Django/Grocery/grocery_proj/asgi.py b/Code/shaina/Django/Grocery/grocery_proj/asgi.py new file mode 100644 index 00000000..9012ee82 --- /dev/null +++ b/Code/shaina/Django/Grocery/grocery_proj/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for grocery_proj 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/4.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'grocery_proj.settings') + +application = get_asgi_application() diff --git a/Code/shaina/Django/Grocery/grocery_proj/settings.py b/Code/shaina/Django/Grocery/grocery_proj/settings.py new file mode 100644 index 00000000..3c12c39d --- /dev/null +++ b/Code/shaina/Django/Grocery/grocery_proj/settings.py @@ -0,0 +1,125 @@ +""" +Django settings for grocery_proj project. + +Generated by 'django-admin startproject' using Django 4.0.3. + +For more information on this file, see +https://docs.djangoproject.com/en/4.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/4.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/4.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-889r8u2be-wami(47w#cnuj@12hk)_(*(8*y@&@$pf*)_(frk@' + +# 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', + + 'grocery_app', +] + +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 = 'grocery_proj.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 = 'grocery_proj.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/4.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/4.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/4.0/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/4.0/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/Code/shaina/Django/Grocery/grocery_proj/urls.py b/Code/shaina/Django/Grocery/grocery_proj/urls.py new file mode 100644 index 00000000..bcd57905 --- /dev/null +++ b/Code/shaina/Django/Grocery/grocery_proj/urls.py @@ -0,0 +1,22 @@ +"""grocery_proj URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/4.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('grocery/', include('grocery_app.urls')) +] diff --git a/Code/shaina/Django/Grocery/grocery_proj/wsgi.py b/Code/shaina/Django/Grocery/grocery_proj/wsgi.py new file mode 100644 index 00000000..567bce68 --- /dev/null +++ b/Code/shaina/Django/Grocery/grocery_proj/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for grocery_proj 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/4.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'grocery_proj.settings') + +application = get_wsgi_application() diff --git a/Code/shaina/Django/Grocery/manage.py b/Code/shaina/Django/Grocery/manage.py new file mode 100644 index 00000000..f97e4e6d --- /dev/null +++ b/Code/shaina/Django/Grocery/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', 'grocery_proj.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/Code/shaina/Django/todo_proj/manage.py b/Code/shaina/Django/todo_proj/manage.py new file mode 100644 index 00000000..6be564d2 --- /dev/null +++ b/Code/shaina/Django/todo_proj/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', 'todo_proj.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/Code/shaina/Django/todo_proj/todo_app/__init__.py b/Code/shaina/Django/todo_proj/todo_app/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/shaina/Django/todo_proj/todo_app/admin.py b/Code/shaina/Django/todo_proj/todo_app/admin.py new file mode 100644 index 00000000..8c38f3f3 --- /dev/null +++ b/Code/shaina/Django/todo_proj/todo_app/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/Code/shaina/Django/todo_proj/todo_app/apps.py b/Code/shaina/Django/todo_proj/todo_app/apps.py new file mode 100644 index 00000000..d8f1498d --- /dev/null +++ b/Code/shaina/Django/todo_proj/todo_app/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class TodoAppConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'todo_app' diff --git a/Code/shaina/Django/todo_proj/todo_app/migrations/__init__.py b/Code/shaina/Django/todo_proj/todo_app/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/shaina/Django/todo_proj/todo_app/models.py b/Code/shaina/Django/todo_proj/todo_app/models.py new file mode 100644 index 00000000..71a83623 --- /dev/null +++ b/Code/shaina/Django/todo_proj/todo_app/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/Code/shaina/Django/todo_proj/todo_app/tests.py b/Code/shaina/Django/todo_proj/todo_app/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/Code/shaina/Django/todo_proj/todo_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/Code/shaina/Django/todo_proj/todo_app/views.py b/Code/shaina/Django/todo_proj/todo_app/views.py new file mode 100644 index 00000000..91ea44a2 --- /dev/null +++ b/Code/shaina/Django/todo_proj/todo_app/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/Code/shaina/Django/todo_proj/todo_proj/__init__.py b/Code/shaina/Django/todo_proj/todo_proj/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/shaina/Django/todo_proj/todo_proj/asgi.py b/Code/shaina/Django/todo_proj/todo_proj/asgi.py new file mode 100644 index 00000000..5a0fd4de --- /dev/null +++ b/Code/shaina/Django/todo_proj/todo_proj/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for todo_proj 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/4.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'todo_proj.settings') + +application = get_asgi_application() diff --git a/Code/shaina/Django/todo_proj/todo_proj/settings.py b/Code/shaina/Django/todo_proj/todo_proj/settings.py new file mode 100644 index 00000000..38821cf7 --- /dev/null +++ b/Code/shaina/Django/todo_proj/todo_proj/settings.py @@ -0,0 +1,123 @@ +""" +Django settings for todo_proj project. + +Generated by 'django-admin startproject' using Django 4.0.3. + +For more information on this file, see +https://docs.djangoproject.com/en/4.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/4.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/4.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-l6%*!xf0yt6zho$4x40fkpcbzs*!9_!!0gs*_jx4d$k=r3(9q-' + +# 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', +] + +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 = 'todo_proj.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 = 'todo_proj.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/4.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/4.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/4.0/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/4.0/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/Code/shaina/Django/todo_proj/todo_proj/urls.py b/Code/shaina/Django/todo_proj/todo_proj/urls.py new file mode 100644 index 00000000..74e1f6e9 --- /dev/null +++ b/Code/shaina/Django/todo_proj/todo_proj/urls.py @@ -0,0 +1,21 @@ +"""todo_proj URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/4.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 + +urlpatterns = [ + path('admin/', admin.site.urls), +] diff --git a/Code/shaina/Django/todo_proj/todo_proj/wsgi.py b/Code/shaina/Django/todo_proj/todo_proj/wsgi.py new file mode 100644 index 00000000..5f96a37b --- /dev/null +++ b/Code/shaina/Django/todo_proj/todo_proj/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for todo_proj 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/4.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'todo_proj.settings') + +application = get_wsgi_application() diff --git a/Code/shaina/Javascript/Cards/app.js b/Code/shaina/Javascript/Cards/app.js new file mode 100644 index 00000000..f5fcf94a --- /dev/null +++ b/Code/shaina/Javascript/Cards/app.js @@ -0,0 +1,50 @@ + +const shuffleBtn = document.querySelector("#shuffle-btn") +const dealBtn = document.querySelector("#deal-btn") +let deckID = null +let hands = { + dealer: [], + player: [] +} + +shuffleBtn.addEventListener("click", getCards) + +dealBtn.addEventListener("click", dealCards) + +async function dealCards() { + const url = `https://deckofcardsapi.com/api/deck/${deckID}/draw/?count=2` + const response = await fetch(url) + const data = await response.json() + + hands.dealer = data.cards + showCards() +} + +function showCards(dealer = false) { + const hand = hands.dealer + const handContainer = document.querySelector("#dealer") + handContainer.innerHTML = "" + + for (card of hand){ + const cardImg = document.createElement('img') + cardImg.src = card.image + handContainer.append(cardImg) + } +} + +async function getCards() { + const response = await fetch("https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1") + const data = await response.json() + console.log(data) + deckID =data.deck_id +} + +// console.log("start of code") + +// fetch("https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1") +// .then(function (data) { +// return data.json() +// } +// ).then(function (data) { +// console.log(data) +// }) \ No newline at end of file diff --git a/Code/shaina/Javascript/Cards/index.html b/Code/shaina/Javascript/Cards/index.html new file mode 100644 index 00000000..554b98eb --- /dev/null +++ b/Code/shaina/Javascript/Cards/index.html @@ -0,0 +1,19 @@ + + + + + + + Cards + + + +
+
+
+
+ + +
+ + \ No newline at end of file