Skip to content

Commit 5bee0b5

Browse files
committed
Deploy Superlists on Cloud Foundry.
1 parent fffede2 commit 5bee0b5

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

manifest.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
applications:
3+
- name: ih-superlists
4+
memory: 512M
5+
instances: 1
6+
buildpack: python_buildpack
7+
command: python manage.py collectstatic --noinput && gunicorn superlists.wsgi:application

requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
django==1.11
22
gunicorn==19.7.1
3+
whitenoise==3.3.1
4+
dj-database-url==0.4.2
5+
psycopg2==2.7.3.1

runtime.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python-3.6.2

superlists/settings.py

+16-8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"""
1212

1313
import os
14+
import dj_database_url
1415

1516
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1617
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -23,9 +24,10 @@
2324
SECRET_KEY = 's&fct_9our6wa6!kk70lsfs#sqp=%225kz5%0)u7x4$@**y+l)'
2425

2526
# SECURITY WARNING: don't run with debug turned on in production!
26-
DEBUG = True
2727

28-
ALLOWED_HOSTS = []
28+
DEBUG = False
29+
30+
ALLOWED_HOSTS = ['ih-superlists.cfapps.io']
2931

3032

3133
# Application definition
@@ -42,6 +44,7 @@
4244

4345
MIDDLEWARE = [
4446
'django.middleware.security.SecurityMiddleware',
47+
'whitenoise.middleware.WhiteNoiseMiddleware',
4548
'django.contrib.sessions.middleware.SessionMiddleware',
4649
'django.middleware.common.CommonMiddleware',
4750
'django.middleware.csrf.CsrfViewMiddleware',
@@ -74,12 +77,17 @@
7477
# Database
7578
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
7679

77-
DATABASES = {
78-
'default': {
79-
'ENGINE': 'django.db.backends.sqlite3',
80-
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
81-
}
82-
}
80+
81+
#DATABASES = {
82+
# 'default': {
83+
# 'ENGINE': 'django.db.backends.sqlite3',
84+
# 'NAME': os.path.join(BASE_DIR, '../database/db.sqlite3'),
85+
# }
86+
#}
87+
print("DATABASE_URL=" + os.environ.get('DATABASE_URL', 'NOT_SPECIFIED'))
88+
LOCAL_SQLITE='sqlite:///' + os.path.abspath(os.path.join(BASE_DIR, '../database/db.sqlite3'))
89+
DATABASES = {}
90+
DATABASES['default'] = dj_database_url.config(default=LOCAL_SQLITE)
8391

8492

8593
# Password validation

0 commit comments

Comments
 (0)