From 68cd42de8366c8a242048657fa706760dfce2a71 Mon Sep 17 00:00:00 2001 From: Aaron <Aaron8.jones@live.uwe.ac.uk> Date: Fri, 14 Mar 2025 10:01:44 +0000 Subject: [PATCH] commiting core db to gitlab please work --- .idea/.gitignore | 8 ++ .idea/DjangoDocker.iml | 26 ++++ .../inspectionProfiles/profiles_settings.xml | 6 + .idea/misc.xml | 7 + .idea/modules.xml | 8 ++ .idea/vcs.xml | 6 + .../DjangoProject/core/__init__.py | 0 ActualProjectCode/DjangoProject/core/admin.py | 6 + ActualProjectCode/DjangoProject/core/apps.py | 6 + .../core/migrations/0001_initial.py | 23 ++++ .../DjangoProject/core/migrations/__init__.py | 0 .../DjangoProject/core/models.py | 14 ++ ActualProjectCode/DjangoProject/core/tests.py | 3 + ActualProjectCode/DjangoProject/core/views.py | 3 + mainDockerImage/backend/server/settings.py | 129 ++++++++++++++++++ 15 files changed, 245 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/DjangoDocker.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 ActualProjectCode/DjangoProject/core/__init__.py create mode 100644 ActualProjectCode/DjangoProject/core/admin.py create mode 100644 ActualProjectCode/DjangoProject/core/apps.py create mode 100644 ActualProjectCode/DjangoProject/core/migrations/0001_initial.py create mode 100644 ActualProjectCode/DjangoProject/core/migrations/__init__.py create mode 100644 ActualProjectCode/DjangoProject/core/models.py create mode 100644 ActualProjectCode/DjangoProject/core/tests.py create mode 100644 ActualProjectCode/DjangoProject/core/views.py create mode 100644 mainDockerImage/backend/server/settings.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/DjangoDocker.iml b/.idea/DjangoDocker.iml new file mode 100644 index 00000000..95172f2d --- /dev/null +++ b/.idea/DjangoDocker.iml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="PYTHON_MODULE" version="4"> + <component name="FacetManager"> + <facet type="django" name="Django"> + <configuration> + <option name="rootFolder" value="$MODULE_DIR$/mainDockerImage/backend" /> + <option name="settingsModule" value="settings.py" /> + <option name="manageScript" value="$MODULE_DIR$/mainDockerImage/backend/manage.py" /> + <option name="environment" value="<map/>" /> + <option name="doNotUseTestRunner" value="false" /> + <option name="trackFilePattern" value="migrations" /> + </configuration> + </facet> + </component> + <component name="NewModuleRootManager"> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/mainDockerImage/backend" isTestSource="false" /> + </content> + <orderEntry type="jdk" jdkName="Python 3.13" jdkType="Python SDK" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> + <component name="PyDocumentationSettings"> + <option name="format" value="PLAIN" /> + <option name="myDocStringFormat" value="Plain" /> + </component> +</module> \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 00000000..105ce2da --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ +<component name="InspectionProjectProfileManager"> + <settings> + <option name="USE_PROJECT_PROFILE" value="false" /> + <version value="1.0" /> + </settings> +</component> \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..1d3ce46b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Black"> + <option name="sdkName" value="Python 3.13" /> + </component> + <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13" project-jdk-type="Python SDK" /> +</project> \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..9d46b613 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/DjangoDocker.iml" filepath="$PROJECT_DIR$/.idea/DjangoDocker.iml" /> + </modules> + </component> +</project> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/ActualProjectCode/DjangoProject/core/__init__.py b/ActualProjectCode/DjangoProject/core/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/ActualProjectCode/DjangoProject/core/admin.py b/ActualProjectCode/DjangoProject/core/admin.py new file mode 100644 index 00000000..62ebc348 --- /dev/null +++ b/ActualProjectCode/DjangoProject/core/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin +from core import models + +# Register your models here. + +admin.site.register(models.user) \ No newline at end of file diff --git a/ActualProjectCode/DjangoProject/core/apps.py b/ActualProjectCode/DjangoProject/core/apps.py new file mode 100644 index 00000000..8115ae60 --- /dev/null +++ b/ActualProjectCode/DjangoProject/core/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class CoreConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'core' diff --git a/ActualProjectCode/DjangoProject/core/migrations/0001_initial.py b/ActualProjectCode/DjangoProject/core/migrations/0001_initial.py new file mode 100644 index 00000000..5732ba1f --- /dev/null +++ b/ActualProjectCode/DjangoProject/core/migrations/0001_initial.py @@ -0,0 +1,23 @@ +# Generated by Django 5.1.7 on 2025-03-13 15:36 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='user', + fields=[ + ('userID', models.IntegerField(primary_key=True, serialize=False)), + ('username', models.CharField(max_length=100)), + ('password', models.CharField(max_length=100)), + ('usertypes', models.CharField(max_length=100)), + ], + ), + ] diff --git a/ActualProjectCode/DjangoProject/core/migrations/__init__.py b/ActualProjectCode/DjangoProject/core/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/ActualProjectCode/DjangoProject/core/models.py b/ActualProjectCode/DjangoProject/core/models.py new file mode 100644 index 00000000..6ec709cf --- /dev/null +++ b/ActualProjectCode/DjangoProject/core/models.py @@ -0,0 +1,14 @@ +from platform import mac_ver + +from django.db import models + +# Create your models here. + +class user(models.Model): + userID = models.IntegerField(primary_key=True) + username = models.CharField(max_length=100) + password = models.CharField(max_length=100) + usertypes = models.CharField(max_length=100) + + def __str__(self): + return self.username \ No newline at end of file diff --git a/ActualProjectCode/DjangoProject/core/tests.py b/ActualProjectCode/DjangoProject/core/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/ActualProjectCode/DjangoProject/core/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/ActualProjectCode/DjangoProject/core/views.py b/ActualProjectCode/DjangoProject/core/views.py new file mode 100644 index 00000000..91ea44a2 --- /dev/null +++ b/ActualProjectCode/DjangoProject/core/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/mainDockerImage/backend/server/settings.py b/mainDockerImage/backend/server/settings.py new file mode 100644 index 00000000..b38af548 --- /dev/null +++ b/mainDockerImage/backend/server/settings.py @@ -0,0 +1,129 @@ +""" +Django settings for server project. + +Generated by 'django-admin startproject' using Django 5.1.6. + +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.parent.parent + +STATIC_URL = "/static/" +STATICFILES_DIRS = [BASE_DIR / 'server'/'frontend' / 'static'] +# 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-g)$()*#j2%^=7c#efw5(gjr$%du8=9mx&tg&3ivtt#s1w%dk*m' + +# 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 = 'server.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ + BASE_DIR / 'server' / 'frontend' / 'templates', # Updated path + ], + '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 = 'server.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' -- GitLab