Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathias Lund Ahrn
tdt4242-base
Commits
cde19659
Commit
cde19659
authored
Mar 06, 2021
by
Mathias Lund Ahrn
Browse files
Fixed cd issues
parent
0c4493a5
Pipeline
#113851
passed with stages
in 2 minutes and 54 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
backend/secfit/secfit/djangoHeroku.py
View file @
cde19659
...
...
@@ -3,11 +3,11 @@ import os
import
dj_database_url
from
django.test.runner
import
DiscoverRunner
from
.djangoHeroku
import
settings
MAX_CONN_AGE
=
600
def
settings
(
config
,
*
,
db_colors
=
False
,
databases
=
True
,
test_runner
=
True
,
staticfiles
=
True
,
allowed_hosts
=
True
,
logging
=
True
,
secret_key
=
True
):
# Database configuration.
...
...
@@ -18,7 +18,7 @@ def settings(config, *, db_colors=False, databases=True, test_runner=True, stati
config
[
'DATABASES'
]
=
{
'default'
:
None
}
conn_max_age
=
config
.
get
(
'CONN_MAX_AGE'
,
MAX_CONN_AGE
)
if
db_colors
:
# Support all Heroku databases.
# TODO: This appears to break TestRunner.
...
...
@@ -28,13 +28,15 @@ def settings(config, *, db_colors=False, databases=True, test_runner=True, stati
#logger.info('Adding ${} to DATABASES Django setting ({}).'.format(env, db_color))
config
[
'DATABASES'
][
db_color
]
=
dj_database_url
.
parse
(
url
,
conn_max_age
=
conn_max_age
,
ssl_require
=
True
)
config
[
'DATABASES'
][
db_color
]
=
dj_database_url
.
parse
(
url
,
conn_max_age
=
conn_max_age
,
ssl_require
=
True
)
if
'DATABASE_URL'
in
os
.
environ
:
#logger.info('Adding $DATABASE_URL to default DATABASE Django setting.')
# Configure Django for DATABASE_URL environment variable.
config
[
'DATABASES'
][
'default'
]
=
dj_database_url
.
config
(
conn_max_age
=
conn_max_age
,
ssl_require
=
True
)
config
[
'DATABASES'
][
'default'
]
=
dj_database_url
.
config
(
conn_max_age
=
conn_max_age
,
ssl_require
=
True
)
#logger.info('Adding $DATABASE_URL to TEST default DATABASE Django setting.')
...
...
@@ -42,7 +44,7 @@ def settings(config, *, db_colors=False, databases=True, test_runner=True, stati
if
'CI'
in
os
.
environ
:
config
[
'DATABASES'
][
'default'
][
'TEST'
]
=
config
[
'DATABASES'
][
'default'
]
#else:
#
else:
#logger.info('$DATABASE_URL not found, falling back to previous settings!')
if
test_runner
:
...
...
@@ -62,9 +64,11 @@ def settings(config, *, db_colors=False, databases=True, test_runner=True, stati
# Insert Whitenoise Middleware.
try
:
config
[
'MIDDLEWARE_CLASSES'
]
=
tuple
([
'whitenoise.middleware.WhiteNoiseMiddleware'
]
+
list
(
config
[
'MIDDLEWARE_CLASSES'
]))
config
[
'MIDDLEWARE_CLASSES'
]
=
tuple
(
[
'whitenoise.middleware.WhiteNoiseMiddleware'
]
+
list
(
config
[
'MIDDLEWARE_CLASSES'
]))
except
KeyError
:
config
[
'MIDDLEWARE'
]
=
tuple
([
'whitenoise.middleware.WhiteNoiseMiddleware'
]
+
list
(
config
[
'MIDDLEWARE'
]))
config
[
'MIDDLEWARE'
]
=
tuple
(
[
'whitenoise.middleware.WhiteNoiseMiddleware'
]
+
list
(
config
[
'MIDDLEWARE'
]))
# Enable GZip.
config
[
'STATICFILES_STORAGE'
]
=
'whitenoise.storage.CompressedManifestStaticFilesStorage'
...
...
backend/secfit/secfit/settings.py
View file @
cde19659
...
...
@@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/3.1/ref/settings/
from
pathlib
import
Path
import
os
from
.djangoHeroku
import
settings
# Get the GROUPID variable to accept connections from the application server and NGINX
...
...
requirements.txt
0 → 100644
View file @
cde19659
B
asgiref
==3.2.10
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment