Skip to content

Commit 0791055

Browse files
committed
Setup the project for render.
1 parent 57114ae commit 0791055

File tree

5 files changed

+60
-5
lines changed

5 files changed

+60
-5
lines changed

build.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
# Exit on error
3+
set -o errexit
4+
5+
# Modify this line as needed for your package manager (pip, poetry, etc.)
6+
pip install -r requirements.txt
7+
8+
# Convert static asset files
9+
python manage.py collectstatic --no-input
10+
11+
# Apply any outstanding database migrations
12+
python manage.py migrate

quickdash/settings.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import dj_database_url
23
from pathlib import Path
34

45
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@@ -12,7 +13,7 @@
1213
SECRET_KEY = 'django-insecure-e#qf)7a0^9x&43v4%8s9&e))19y0=fua%f9)h*$@t3271%ysnw'
1314

1415
# SECURITY WARNING: don't run with debug turned on in production!
15-
DEBUG = True
16+
DEBUG = False
1617

1718
# Email Sending
1819
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
@@ -23,7 +24,7 @@
2324
EMAIL_HOST_USER = 'adekomuheez567@gmail.com'
2425
EMAIL_HOST_PASSWORD = 'xbve hlsd rdig zxfu'
2526

26-
ALLOWED_HOSTS = []
27+
ALLOWED_HOSTS = ['*']
2728

2829

2930
# Application definition
@@ -36,9 +37,9 @@
3637
'django.contrib.messages',
3738
'django.contrib.staticfiles',
3839

39-
'core',
40-
'users',
41-
'orders',
40+
'core.apps.CoreConfig',
41+
'users.apps.UsersConfig',
42+
'orders.apps.OrdersConfig',
4243

4344
'background_task',
4445
]
@@ -51,6 +52,7 @@
5152
'django.contrib.auth.middleware.AuthenticationMiddleware',
5253
'django.contrib.messages.middleware.MessageMiddleware',
5354
'django.middleware.clickjacking.XFrameOptionsMiddleware',
55+
'whitenoise.middleware.WhiteNoiseMiddleware',
5456
]
5557

5658
ROOT_URLCONF = 'quickdash.urls'
@@ -131,6 +133,10 @@
131133
MEDIA_URL = '/media/'
132134
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
133135

136+
if not DEBUG:
137+
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
138+
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
139+
134140
# Default primary key field type
135141
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
136142

render.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
databases:
2+
- name: mysitedb
3+
plan: free
4+
databaseName: mysite
5+
user: mysite
6+
7+
services:
8+
- type: web
9+
plan: free
10+
name: mysite
11+
runtime: python
12+
buildCommand: "./build.sh"
13+
startCommand: "python -m gunicorn quickdash.asgi:application -k uvicorn.workers.UvicornWorker"
14+
envVars:
15+
- key: DATABASE_URL
16+
fromDatabase:
17+
name: mysitedb
18+
property: connectionString
19+
- key: SECRET_KEY
20+
generateValue: true
21+
- key: WEB_CONCURRENCY
22+
value: 4

requirements.txt

+10
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,32 @@ click-plugins==1.1.1
99
click-repl==0.3.0
1010
colorama==0.4.6
1111
cron-descriptor==1.4.5
12+
dj-database-url==2.3.0
1213
Django==5.1.3
1314
django-background-tasks==1.2.8
1415
django-common-helpers==0.9.2
1516
django-timezone-field==7.0
1617
geographiclib==2.0
1718
geopy==2.4.1
19+
gunicorn==23.0.0
1820
idna==3.10
1921
kombu==5.4.2
22+
packaging==24.2
23+
pillow==11.0.0
2024
prompt_toolkit==3.0.48
25+
psycopg-binary==3.2.3
26+
psycopg2-binary==2.9.10
2127
python-crontab==3.2.0
2228
python-dateutil==2.9.0.post0
2329
redis==5.2.0
2430
requests==2.32.2
2531
six==1.16.0
2632
sqlparse==0.5.2
33+
typing_extensions==4.12.2
2734
tzdata==2024.2
2835
urllib3==2.2.3
36+
uvicorn==0.32.1
2937
vine==5.1.0
38+
waitress==3.0.2
3039
wcwidth==0.2.13
40+
whitenoise==6.8.2

server.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from waitress import serve
2+
from quickdash.wsgi import application
3+
4+
if __name__ == '__main__':
5+
serve(application, port='8000')

0 commit comments

Comments
 (0)