Skip to content

Commit da56a58

Browse files
committed
Package upgrades & switch to environs
1 parent 78b575c commit da56a58

9 files changed

+118
-189
lines changed

.environment-example renamed to .env-example

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# copy this file's contents into .environment and amend as required
1+
# copy this file's contents into .env and amend as required
22

3+
export PYTHONDEVMODE=0
34
export DJANGO_SETTINGS_MODULE="project.settings"
45
export CLEAN_PYC="yes"
56

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ services:
4242
target: app
4343

4444
nginx:
45-
image: public.ecr.aws/s1h1q3x3/django-nginx:1.18.0
45+
image: nginx:1.18.0
4646
depends_on:
4747
- python
4848
environment:

manage.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
"""Django's command-line utility for administrative tasks."""
33
import os
44
import sys
5+
from pathlib import Path
56

6-
from dotenv import load_dotenv, find_dotenv
7-
load_dotenv(find_dotenv(filename='.environment'))
7+
from environs import Env
8+
9+
env = Env()
10+
env.read_env()
811

912

1013
def main():
@@ -26,6 +29,20 @@ def main():
2629
os.system(cmd)
2730
# sys.stdout.write('done\n\n')
2831

32+
try:
33+
import pip_lock
34+
except ImportError:
35+
raise ImportError(
36+
"Couldn't import pip-lock. Are you on the right virtualenv and up "
37+
+ "to date?"
38+
)
39+
40+
requirements_path = str(Path(__file__).parent / "requirements.txt")
41+
pip_lock.check_requirements(
42+
requirements_path,
43+
post_text="\nRun the following:\n\npip-sync\n",
44+
)
45+
2946
execute_from_command_line(sys.argv)
3047

3148

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "cms-playground",
3-
"description": "Project for trying out new things around django cms 4 and AWS",
2+
"name": "django-cms-4",
3+
"description": "Project for trying out new things around django cms 4",
44
"version": "0.0.1",
55
"repository": {
66
"type": "git",
7-
"url": "https://git-codecommit.eu-west-2.amazonaws.com/v1/repos/cms_playground"
7+
"url": "https://github.com/marksweb/django-cms-4"
88
},
99
"keywords": [
1010
"django",

project/settings.py

+11-17
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"""
1212
import os
1313

14-
from .utils.sanitize import sanitize
14+
from environs import Env
1515

1616

1717
def gettext(s):
@@ -21,7 +21,7 @@ def gettext(s):
2121
return s
2222

2323

24-
env = os.environ.get
24+
env = Env()
2525

2626
# ***** PATHS *****
2727

@@ -35,8 +35,8 @@ def gettext(s):
3535
RELEASE_NUMBER = __import__('project').VERSION
3636
VERSION = RELEASE_NUMBER
3737

38-
DEBUG = sanitize(env('DEBUG', 'no'), bool)
39-
BUILD_ENV = sanitize(env('BUILD_ENV', 'no'), bool)
38+
DEBUG = env.bool('DEBUG', 'no')
39+
BUILD_ENV = env.bool('BUILD_ENV', 'no')
4040
WSGI_APPLICATION = 'project.wsgi.application'
4141
ROOT_URLCONF = 'project.urls'
4242

@@ -55,19 +55,13 @@ def gettext(s):
5555

5656
REFERRER_POLICY = 'strict-origin'
5757

58-
CSRF_COOKIE_SECURE = sanitize(env('CSRF_COOKIE_SECURE', False), bool)
59-
SESSION_COOKIE_SECURE = sanitize(env('SESSION_COOKIE_SECURE', False), bool)
58+
CSRF_COOKIE_SECURE = env.bool('CSRF_COOKIE_SECURE', False)
59+
SESSION_COOKIE_SECURE = env.bool('SESSION_COOKIE_SECURE', False)
6060

61-
SECURE_BROWSER_XSS_FILTER = sanitize(
62-
env('SECURE_BROWSER_XSS_FILTER', False), bool
63-
)
64-
SECURE_CONTENT_TYPE_NOSNIFF = sanitize(
65-
env('SECURE_CONTENT_TYPE_NOSNIFF', False), bool
66-
)
67-
SECURE_HSTS_SECONDS = sanitize(env('SECURE_HSTS_SECONDS', 31536000), int)
68-
SECURE_HSTS_INCLUDE_SUBDOMAINS = sanitize(
69-
env('SECURE_HSTS_INCLUDE_SUBDOMAINS', False), bool
70-
)
61+
SECURE_BROWSER_XSS_FILTER = env.bool('SECURE_BROWSER_XSS_FILTER', False)
62+
SECURE_CONTENT_TYPE_NOSNIFF = env.bool('SECURE_CONTENT_TYPE_NOSNIFF', False)
63+
SECURE_HSTS_SECONDS = env.int('SECURE_HSTS_SECONDS', 31536000)
64+
SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool('SECURE_HSTS_INCLUDE_SUBDOMAINS', False)
7165

7266
# Application definition
7367

@@ -294,7 +288,7 @@ def gettext(s):
294288

295289
# ***** DEBUG TOOLBAR *****
296290

297-
DEBUG_TOOLBAR = DEBUG and env('DEBUG_TOOLBAR', 'no') == 'yes'
291+
DEBUG_TOOLBAR = DEBUG and env.bool('DEBUG_TOOLBAR', 'no')
298292

299293
if DEBUG_TOOLBAR:
300294
INTERNAL_IPS = [

project/utils/__init__.py

Whitespace-only changes.

project/utils/sanitize.py

-90
This file was deleted.

requirements.in

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
cryptography<3.4
2-
django
2+
django<4.0
33
django-apptemplates
4-
-e git://github.com/django-cms/django-cms.git@release/4.0.x#egg=django-cms
5-
https://github.com/ojii/django-app-manage/archive/65da18ef234a4e985710c2c0ec760023695b40fe.zip#egg=django-app-manage
6-
https://github.com/divio/djangocms-text-ckeditor/archive/support/4.0.x.zip
4+
-e git://github.com/django-cms/django-cms.git@develop-4#egg=django-cms
5+
-e git://github.com/django-cms/djangocms-text-ckeditor.git@support/4.0.x#egg=djangocms-text-ckeditor
76
django-extensions
87
django-filer>=1.3
98
django-storages[boto3]
109
https://github.com/divio/djangocms-alias/tarball/master#egg=djangocms-alias
11-
-e git://github.com/divio/djangocms-url-manager.git@0.0.11#egg=djangocms-url-manager
12-
https://github.com/divio/djangocms-versioning/tarball/master#egg=djangocms-versioning
13-
-e git://github.com/FidelityInternational/djangocms-pageadmin.git@0.0.14#egg=djangocms-pageadmin
14-
-e git://github.com/FidelityInternational/djangocms-version-locking.git@0.0.14#egg=djangocms-version-locking
10+
-e git://github.com/Aiky30/djangocms-url-manager.git@feature/django-32-compat#egg=djangocms-url-manager
11+
https://github.com/django-cms/djangocms-versioning/tarball/master#egg=djangocms-versioning
12+
-e git://github.com/FidelityInternational/djangocms-pageadmin.git@1.0.0#egg=djangocms-pageadmin
13+
-e git://github.com/FidelityInternational/djangocms-version-locking.git@master#egg=djangocms-version-locking
1514
easy_thumbnails
15+
environs
16+
pip-lock
1617
psycopg2==2.8.6
1718
python-dotenv
1819
pytz

0 commit comments

Comments
 (0)