Skip to content

Commit 54d7358

Browse files
Heroku Deployment
1 parent 2ef38a5 commit 54d7358

File tree

4 files changed

+49
-7
lines changed

4 files changed

+49
-7
lines changed

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,43 @@
1+
# Virtual Environment
12
/project_env
3+
4+
# Byte-compiled / optimized / DLL files
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
9+
# C extensions
10+
*.so
11+
12+
# Distribution / packaging
13+
.Python
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
share/python-wheels/
27+
*.egg-info/
28+
.installed.cfg
29+
*.egg
30+
MANIFEST
31+
32+
# Installer logs
33+
pip-log.txt
34+
pip-delete-this-directory.txt
35+
36+
# Django stuff:
37+
*.log
38+
local_settings.py
39+
db.sqlite3
40+
db.sqlite3-journal
41+
42+
# Environments
43+
.env

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: gunicorn django_blog.wsgi

django_blog/settings.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
import os
1414
import json
1515

16-
with open('/etc/config.json') as config_file:
17-
config = json.load(config_file)
18-
1916
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
2017
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
2118

@@ -24,12 +21,12 @@
2421
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
2522

2623
# SECURITY WARNING: keep the secret key used in production secret!
27-
SECRET_KEY = config['SECRET_KEY']
24+
SECRET_KEY = os.environ.get('SECRET_KEY')
2825

2926
# SECURITY WARNING: don't run with debug turned on in production!
3027
DEBUG = True
3128

32-
ALLOWED_HOSTS = []
29+
ALLOWED_HOSTS = ['andrewbaldwin-django-blogger.herokuapp.com']
3330

3431

3532
# Application definition
@@ -124,6 +121,7 @@
124121
# Static files (CSS, JavaScript, Images)
125122
# https://docs.djangoproject.com/en/3.0/howto/static-files/
126123

124+
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
127125
STATIC_URL = '/static/'
128126

129127
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
@@ -138,6 +136,6 @@
138136
EMAIL_HOST = 'smtp.gmail.com'
139137
EMAIL_PORT = 587
140138
EMAIL_USE_TLS = True
141-
EMAIL_HOST_USER = config['EMAIL_USER']
142-
EMAIL_HOST_PASSWORD = config['EMAIL_PASS']
139+
EMAIL_HOST_USER = os.environ.get('EMAIL_USER')
140+
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_PASS')
143141
DEFAULT_FROM_EMAIL = 'CodingWithAndrewTeam <[email protected]>'

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ certifi==2018.1.18
22
chardet==3.0.4
33
Django==3.0.5
44
django-crispy-forms==1.9.0
5+
gunicorn==20.0.4
56
idna==2.6
67
Pillow==7.1.1
78
requests==2.20.0

0 commit comments

Comments
 (0)