Skip to content

Commit

Permalink
steps 1-6 of django deployment done, including tweak for frontend dep…
Browse files Browse the repository at this point in the history
…loyment
  • Loading branch information
BChan26 committed Jan 5, 2023
1 parent 28be634 commit f4e532a
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 15 deletions.
19 changes: 19 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.env
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
db.sqlite3-journal
media

# General MacOS files to ignore
.DS_Store
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
4 changes: 4 additions & 0 deletions backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ name = "pypi"
django = "*"
psycopg2-binary = "*"
djangorestframework = "*"
whitenoise = "*"
dj-database-url = "*"
gunicorn = "*"
django-cors-headers = "*"

[dev-packages]

Expand Down
48 changes: 44 additions & 4 deletions backend/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/Profile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn project.wsgi
33 changes: 22 additions & 11 deletions backend/project/settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import os
import dj_database_url

"""
Django settings for project project.
Expand All @@ -20,12 +23,12 @@
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-lq42k+_wq=ht6^hnc%n!0m+j^xaj!7_(uc3x)92hocb7q#r$+k'
SECRET_KEY = os.environ['SECRET_KEY']

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = True if os.environ['MODE'] == 'dev' else False

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['*']


# Application definition
Expand Down Expand Up @@ -55,7 +58,9 @@

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
Expand Down Expand Up @@ -95,17 +100,20 @@
# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases

# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql',
# 'NAME': 'studentdata',
# 'USER': 'teacheruser',
# 'PASSWORD': 'teacherpassword',
# 'HOST': 'localhost'
# }
# }

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'studentdata',
'USER': 'teacheruser',
'PASSWORD': 'teacherpassword',
'HOST': 'localhost'
}
'default': dj_database_url.config(conn_max_age=600)
}


# Password validation
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators

Expand Down Expand Up @@ -146,3 +154,6 @@
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'


STATIC_ROOT=os.path.join(BASE_DIR, "static/")
3 changes: 3 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@
"autoprefixer": "^10.4.13",
"postcss": "^8.4.20",
"tailwindcss": "^3.2.4"
},
"overrides": {
"@babel/plugin-transform-block-scoping": "7.20.5"
}
}

0 comments on commit f4e532a

Please sign in to comment.