Skip to content

Instantly share code, notes, and snippets.

@codetombomb
codetombomb / settings.py
Created September 29, 2020 19:38
Configuring the new db
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'ctbportfoliodb',
'USER': 'postgres',
'PASSWORD': 'whateverpasswordyouusedwhenwesetitupasecago',
'HOST': 'localhost',
'PORT': '5432',
}
@codetombomb
codetombomb / settings.py
Created September 29, 2020 18:48
Data Base info in settings.py
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
@codetombomb
codetombomb / models.py
Last active September 29, 2020 18:33
Model example with attributes
from django.db import models
# Create your models here.
# I would like for my Projects model to include the following attributes:
# -Images
# -Summary
# -Link for Video
@codetombomb
codetombomb / projects.html
Created September 26, 2020 03:20
Sample code to check functionality
<h1>Hello from projects.html</h1>
@codetombomb
codetombomb / projects.html
Created September 26, 2020 03:19
test code for html file
<h1>Hello from projects.html</h1>
@codetombomb
codetombomb / views.py
Last active September 26, 2020 02:28
Defining the projects fucntion
rom django.shortcuts import render
# Create your views here.
def projects(request):
return render(request, 'projects/projects.html')
@codetombomb
codetombomb / views.py
Created September 26, 2020 02:17
A peek inside of the projects views.py
from django.shortcuts import render
# Create your views here.
@codetombomb
codetombomb / urls.py
Last active September 26, 2020 02:06
Adding path to views in app
from django.contrib import admin
from django.urls import path
import projects.views
urlpatterns = [
path('admin/', admin.site.urls),
path('projects', projects.views.projects)
]
@codetombomb
codetombomb / urls.py
Created September 26, 2020 01:42
Adding a path for 'contact'
from django.contrib import admin
from django.urls import path
urlpatterns = [
path('admin/', admin.site.urls),
path(),
]
@codetombomb
codetombomb / urls.py
Created September 26, 2020 01:30
Adding a Uniform Resource Locator
urlpatterns = [
path('admin/', admin.site.urls),
]