소스 검색

Add heroku config for sandbox.

master
Samir Shah 6 년 전
부모
커밋
6eb079b9f1
9개의 변경된 파일46개의 추가작업 그리고 45개의 파일을 삭제
  1. 2
    2
      Dockerfile
  2. 2
    2
      README.rst
  3. 22
    0
      app.json
  4. 1
    2
      docs/source/internals/sandbox.rst
  5. 5
    0
      heroku.yml
  6. 1
    1
      requirements.txt
  7. 2
    2
      sandbox/README.rst
  8. 9
    28
      sandbox/settings.py
  9. 2
    8
      sandbox/uwsgi.ini

+ 2
- 2
Dockerfile 파일 보기

1
 FROM python:3.5
1
 FROM python:3.5
2
 ENV PYTHONUNBUFFERED 1
2
 ENV PYTHONUNBUFFERED 1
3
 
3
 
4
-RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
4
+RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
5
 RUN apt-get install -y nodejs
5
 RUN apt-get install -y nodejs
6
 
6
 
7
 COPY ./requirements.txt /requirements.txt
7
 COPY ./requirements.txt /requirements.txt
8
-RUN pip3 install -r /requirements.txt raven==5.32.0
8
+RUN pip3 install -r /requirements.txt
9
 
9
 
10
 RUN groupadd -r django && useradd -r -g django django
10
 RUN groupadd -r django && useradd -r -g django django
11
 COPY . /app
11
 COPY . /app

+ 2
- 2
README.rst 파일 보기

66
 .. end-no-pypi
66
 .. end-no-pypi
67
 
67
 
68
 .. _`Official homepage`: http://oscarcommerce.com
68
 .. _`Official homepage`: http://oscarcommerce.com
69
-.. _`Sandbox site`: http://latest.oscarcommerce.com
69
+.. _`Sandbox site`: https://latest.oscarcommerce.com
70
 .. _`Docker image`: https://hub.docker.com/r/oscarcommerce/django-oscar-sandbox/
70
 .. _`Docker image`: https://hub.docker.com/r/oscarcommerce/django-oscar-sandbox/
71
 .. _`Documentation`: https://django-oscar.readthedocs.io/en/stable/
71
 .. _`Documentation`: https://django-oscar.readthedocs.io/en/stable/
72
 .. _`readthedocs.org`: http://readthedocs.org
72
 .. _`readthedocs.org`: http://readthedocs.org
129
 The sandbox site can be set-up locally `in 5 commands`_.  Want to
129
 The sandbox site can be set-up locally `in 5 commands`_.  Want to
130
 make changes?  Check out the `contributing guidelines`_.
130
 make changes?  Check out the `contributing guidelines`_.
131
 
131
 
132
-.. _`this gateway page`: http://latest.oscarcommerce.com/gateway/
132
+.. _`this gateway page`: https://latest.oscarcommerce.com/gateway/
133
 .. _`in 5 commands`: https://django-oscar.readthedocs.io/en/stable/internals/sandbox.html#running-the-sandbox-locally
133
 .. _`in 5 commands`: https://django-oscar.readthedocs.io/en/stable/internals/sandbox.html#running-the-sandbox-locally
134
 .. _`contributing guidelines`: https://django-oscar.readthedocs.io/en/stable/internals/contributing/index.html
134
 .. _`contributing guidelines`: https://django-oscar.readthedocs.io/en/stable/internals/contributing/index.html
135
 
135
 

+ 22
- 0
app.json 파일 보기

1
+{
2
+  "name": "django-oscar",
3
+  "description": "Django Oscar sandbox site",
4
+  "env": {
5
+    "ALLOWED_HOSTS": {
6
+      "required": true
7
+    },
8
+    "SECRET_KEY": {
9
+      "required": true
10
+    },
11
+    "SECURE_SSL_REDIRECT": {
12
+      "required": true
13
+    }
14
+  },
15
+  "formation": {
16
+    "web": {
17
+      "quantity": 1,
18
+      "size": "free"
19
+    }
20
+  },
21
+  "stack": "container"
22
+}

+ 1
- 2
docs/source/internals/sandbox.rst 파일 보기

35
 Browse the external sandbox site
35
 Browse the external sandbox site
36
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37
 
37
 
38
-An instance of the sandbox site is built hourly from master branch and made
39
-available at http://latest.oscarcommerce.com
38
+An instance of the sandbox site is made available at https://latest.oscarcommerce.com
40
 
39
 
41
 .. warning::
40
 .. warning::
42
 
41
 

+ 5
- 0
heroku.yml 파일 보기

1
+build:
2
+  docker:
3
+    web: Dockerfile
4
+run:
5
+  web: uwsgi --ini uwsgi.ini --http 0:$PORT

+ 1
- 1
requirements.txt 파일 보기

4
 Werkzeug==0.15.4
4
 Werkzeug==0.15.4
5
 django-debug-toolbar==2.0
5
 django-debug-toolbar==2.0
6
 django-extensions==2.2.1
6
 django-extensions==2.2.1
7
-psycopg2>=2.7,<2.8 --no-binary psycopg2
7
+psycopg2-binary>=2.8,<2.9
8
 
8
 
9
 # Sandbox
9
 # Sandbox
10
 Pillow==6.1.0
10
 Pillow==6.1.0

+ 2
- 2
sandbox/README.rst 파일 보기

4
 
4
 
5
 This site is deployed there:
5
 This site is deployed there:
6
 
6
 
7
-http://latest.oscarcommerce.com
7
+https://latest.oscarcommerce.com
8
 -------------------------------
8
 -------------------------------
9
 
9
 
10
 This is a vanilla install of Oscar with as little customisation as possible to
10
 This is a vanilla install of Oscar with as little customisation as possible to
17
 * A profile model with a few fields, designed to test Oscar's account section
17
 * A profile model with a few fields, designed to test Oscar's account section
18
   which should automatically allow the profile fields to be edited.
18
   which should automatically allow the profile fields to be edited.
19
 
19
 
20
-It is deployed automatically to: http://latest.oscarcommerce.com
20
+It is deployed automatically to: https://latest.oscarcommerce.com

+ 9
- 28
sandbox/settings.py 파일 보기

10
 
10
 
11
 DEBUG = env.bool('DEBUG', default=True)
11
 DEBUG = env.bool('DEBUG', default=True)
12
 
12
 
13
-ALLOWED_HOSTS = [
14
-    'latest.oscarcommerce.com',
15
-    'master.oscarcommerce.com',
16
-    'localhost',
17
-    '127.0.0.1',
18
-]
13
+ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=['localhost', '127.0.0.1'])
19
 
14
 
20
-# This is needed for the hosted version of the sandbox
21
-ADMINS = (
22
-    ('David Winterbottom', 'david.winterbottom@gmail.com'),
23
-    ('Michael van Tellingen', 'michaelvantellingen@gmail.com'),
24
-)
25
 EMAIL_SUBJECT_PREFIX = '[Oscar sandbox] '
15
 EMAIL_SUBJECT_PREFIX = '[Oscar sandbox] '
26
 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
16
 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
27
 
17
 
28
-MANAGERS = ADMINS
29
-
30
 # Use a Sqlite database by default
18
 # Use a Sqlite database by default
31
 DATABASES = {
19
 DATABASES = {
32
     'default': {
20
     'default': {
119
 )
107
 )
120
 
108
 
121
 # Make this unique, and don't share it with anybody.
109
 # Make this unique, and don't share it with anybody.
122
-SECRET_KEY = '$)a7n&o80u!6y5t-+jrd3)3!%vh&shg$wqpjpxc!ar&p#!)n1a'
110
+SECRET_KEY = env.str('SECRET_KEY', default='UajFCuyjDKmWHe29neauXzHi9eZoRXr6RMbT5JyAdPiACBP6Cra2')
123
 
111
 
124
 TEMPLATES = [
112
 TEMPLATES = [
125
     {
113
     {
160
 
148
 
161
     'django.contrib.sessions.middleware.SessionMiddleware',
149
     'django.contrib.sessions.middleware.SessionMiddleware',
162
     'django.middleware.csrf.CsrfViewMiddleware',
150
     'django.middleware.csrf.CsrfViewMiddleware',
151
+    'django.middleware.clickjacking.XFrameOptionsMiddleware',
163
     'django.contrib.auth.middleware.AuthenticationMiddleware',
152
     'django.contrib.auth.middleware.AuthenticationMiddleware',
164
     'django.contrib.messages.middleware.MessageMiddleware',
153
     'django.contrib.messages.middleware.MessageMiddleware',
165
     'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
154
     'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
418
 # on-the-fly less processor.
407
 # on-the-fly less processor.
419
 OSCAR_USE_LESS = False
408
 OSCAR_USE_LESS = False
420
 
409
 
421
-
422
-# Sentry
423
-# ======
424
-
425
-if env('SENTRY_DSN', default=None):
426
-    RAVEN_CONFIG = {'dsn': env('SENTRY_DSN', default=None)}
427
-    LOGGING['handlers']['sentry'] = {
428
-        'level': 'ERROR',
429
-        'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
430
-    }
431
-    LOGGING['root']['handlers'].append('sentry')
432
-    INSTALLED_APPS.append('raven.contrib.django.raven_compat')
433
-
434
-
435
 # Sorl
410
 # Sorl
436
 # ====
411
 # ====
437
 
412
 
449
 # in tests/config.py
424
 # in tests/config.py
450
 SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
425
 SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
451
 
426
 
427
+# Security
428
+SECURE_SSL_REDIRECT = env.bool('SECURE_SSL_REDIRECT', default=False)
429
+SECURE_HSTS_SECONDS = env.int('SECURE_HSTS_SECONDS', default=0)
430
+SECURE_CONTENT_TYPE_NOSNIFF = True
431
+SECURE_BROWSER_XSS_FILTER = True
432
+
452
 # Try and import local settings which can be used to override any of the above.
433
 # Try and import local settings which can be used to override any of the above.
453
 try:
434
 try:
454
     from settings_local import *
435
     from settings_local import *

+ 2
- 8
sandbox/uwsgi.ini 파일 보기

6
 http-enable-proxy-protocol = 1
6
 http-enable-proxy-protocol = 1
7
 http-auto-chunked = true
7
 http-auto-chunked = true
8
 http-keepalive = 75
8
 http-keepalive = 75
9
-http-timeout = 75  
9
+http-timeout = 75
10
 
10
 
11
 log-x-forwarded-for = true
11
 log-x-forwarded-for = true
12
 
12
 
13
 # Handle docker stop
13
 # Handle docker stop
14
-die-on-term = 1  
14
+die-on-term = 1
15
 
15
 
16
 vacuum = 1
16
 vacuum = 1
17
 master = true
17
 master = true
31
 
31
 
32
 static-map = /media=./public/media/
32
 static-map = /media=./public/media/
33
 
33
 
34
-# Custom headers
35
-add-header = X-Content-Type-Options: nosniff
36
-add-header = X-XSS-Protection: 1; mode=block
37
-add-header = Strict-Transport-Security: max-age=16070400
38
-add-header = Connection: Keep-Alive
39
-
40
 ; if the client supports gzip encoding goto to the gzipper
34
 ; if the client supports gzip encoding goto to the gzipper
41
 route-if = contains:${HTTP_ACCEPT_ENCODING};gzip goto:_gzip
35
 route-if = contains:${HTTP_ACCEPT_ENCODING};gzip goto:_gzip
42
 route-run = last:
36
 route-run = last:

Loading…
취소
저장