Skip to content

Commit

Permalink
LinkedInLearning#1 updated db
Browse files Browse the repository at this point in the history
  • Loading branch information
Shamaine committed Feb 16, 2024
1 parent 9e9193e commit cf56580
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 32 deletions.
3 changes: 0 additions & 3 deletions home/tests.py

This file was deleted.

Empty file added home/tests/test_views.py
Empty file.
6 changes: 5 additions & 1 deletion notes/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Generated by Django 3.2.2 on 2021-07-18 15:28
# Generated by Django 4.0.10 on 2024-02-16 02:03

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
Expand All @@ -18,6 +21,7 @@ class Migration(migrations.Migration):
('title', models.CharField(max_length=200)),
('text', models.TextField()),
('created', models.DateTimeField(auto_now_add=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes', to=settings.AUTH_USER_MODEL)),
],
),
]
22 changes: 0 additions & 22 deletions notes/migrations/0002_notes_user.py

This file was deleted.

4 changes: 4 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pytest]

DJANGO_SETTINGS_MODULE = smartnotes.settings
python_files = tests.py test_*.py
8 changes: 8 additions & 0 deletions smartnotes/db_conn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class dbconn:
engine = 'mssql'
name = 'myunittestdb'
user=''
password=''
port=''
host = 'MY-XUEERCHUNG\SQLEXPRESS'
driver = 'ODBC Driver 17 for SQL Server'
18 changes: 12 additions & 6 deletions smartnotes/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

from pathlib import Path

from .db_conn import dbconn
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

Expand Down Expand Up @@ -76,13 +76,19 @@
WSGI_APPLICATION = 'smartnotes.wsgi.application'


# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
db = dbconn()

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
"default": {
"ENGINE": db.engine,
"NAME": db.name,
"USER": db.user,
"PASSWORD": db.password,
"HOST": db.host,
"PORT": db.port,
"OPTIONS": {
"driver": db.driver,
},
}
}

Expand Down

0 comments on commit cf56580

Please sign in to comment.