Skip to content

Instantly share code, notes, and snippets.

@piatra
Last active April 9, 2018 20:09
Show Gist options
  • Save piatra/b56a9722d48b4bb1e75726693e997a95 to your computer and use it in GitHub Desktop.
Save piatra/b56a9722d48b4bb1e75726693e997a95 to your computer and use it in GitHub Desktop.
run mozmeao/snippets-service locally
diff --git a/snippets/settings.py b/snippets/settings.py
index 91e4e5a..f1e8dd6 100644
--- a/snippets/settings.py
+++ b/snippets/settings.py
@@ -199,12 +199,14 @@ TEMPLATES = [
CSP_DEFAULT_SRC = (
"'self'",
+ "'unsafe-inline'",
)
CSP_IMG_SRC = (
"'self'",
+ "'unsafe-inline'",
"data:",
)
-CSP_REPORT_ONLY = config('CSP_REPORT_ONLY', default=False, cast=bool)
+CSP_REPORT_ONLY = config('CSP_REPORT_ONLY', default=True, cast=bool)
CSP_REPORT_ENABLE = config('CSP_REPORT_ENABLE', default=True, cast=bool)
if CSP_REPORT_ENABLE:
CSP_REPORT_URI = config('CSP_REPORT_URI', default='/csp-violation-capture')
@@ -212,7 +214,7 @@ if CSP_REPORT_ENABLE:
SNIPPET_SIZE_LIMIT = 500
SNIPPET_IMAGE_SIZE_LIMIT = 250
-ENABLE_ADMIN = config('ENABLE_ADMIN', default=False, cast=bool)
+ENABLE_ADMIN = config('ENABLE_ADMIN', default=True, cast=bool)
CSRF_USE_SESSIONS = config('CSRF_USE_SESSIONS', default=True, cast=bool)
SNIPPET_BUNDLE_TIMEOUT = config('SNIPPET_BUNDLE_TIMEOUT', default=15 * 60, cast=int) # 15 minutes
  1. Install Docker
  2. cd snippets-service and run docker-compose up
  3. run docker ps get the name of the container for the web service
    1. docker exec -it <container_name> /bin/bash
    2. python manage.py migrate --noinput
    3. python manage.py createsuperuser
  4. Some setting changes for CSP rules (otherwise it will complain about running on localhost, at least that is what happend to me)
    1. apply patch
  5. Login at localhost:8000/admin with superuser created previously
  6. add the snippet template https://github.com/mozmeao/snippets-service/blob/master/simple_template_server/snippets_as/snippet-one.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment