misc: devcontainer - django debug toolbar profile + dockerfile cleanup
- Legacy-Id: 19529
This commit is contained in:
parent
9c903f1b01
commit
c2979adc2b
|
@ -64,14 +64,6 @@ RUN apt-get install -qy \
|
||||||
zile \
|
zile \
|
||||||
zlib1g-dev
|
zlib1g-dev
|
||||||
|
|
||||||
# Install libyang
|
|
||||||
# RUN wget -nv http://download.opensuse.org/repositories/home:liberouter/Debian_9.0/Release.key && \
|
|
||||||
# apt-key add - < Release.key && \
|
|
||||||
# rm Release.key && \
|
|
||||||
# echo "deb http://download.opensuse.org/repositories/home:/liberouter/Debian_9.0/ /" >> /etc/apt/sources.list.d/libyang.list && \
|
|
||||||
# apt-get update && \
|
|
||||||
# apt-get install -qy libyang1
|
|
||||||
|
|
||||||
# Install chromedriver
|
# Install chromedriver
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y gnupg wget curl unzip --no-install-recommends && \
|
apt-get install -y gnupg wget curl unzip --no-install-recommends && \
|
||||||
|
@ -120,12 +112,6 @@ RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requ
|
||||||
COPY .devcontainer/init.sh /docker-init.sh
|
COPY .devcontainer/init.sh /docker-init.sh
|
||||||
RUN sed -i 's/\r$//' /docker-init.sh && \
|
RUN sed -i 's/\r$//' /docker-init.sh && \
|
||||||
chmod +x /docker-init.sh
|
chmod +x /docker-init.sh
|
||||||
|
|
||||||
# ENTRYPOINT ["/usr/local/share/datatracker/.devcontainer/init.sh"]
|
# ENTRYPOINT ["/usr/local/share/datatracker/.devcontainer/init.sh"]
|
||||||
CMD ["sleep", "infinity"]
|
CMD ["sleep", "infinity"]
|
||||||
|
|
||||||
# [Optional] Uncomment this section to install additional OS packages.
|
|
||||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
|
||||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
|
||||||
|
|
||||||
# [Optional] Uncomment this line to install global node packages.
|
|
||||||
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
|
|
|
@ -83,11 +83,16 @@ fi
|
||||||
echo "Activating the virtual python environment ..."
|
echo "Activating the virtual python environment ..."
|
||||||
. $VIRTDIR/bin/activate
|
. $VIRTDIR/bin/activate
|
||||||
|
|
||||||
if [ ! -f $WORKSPACEDIR/ietf/settings_local.py ]; then
|
if [ ! -f "$WORKSPACEDIR/ietf/settings_local.py" ]; then
|
||||||
echo "Setting up a default settings_local.py ..."
|
echo "Setting up a default settings_local.py ..."
|
||||||
cp $WORKSPACEDIR/.devcontainer/settings_local.py $WORKSPACEDIR/ietf/settings_local.py
|
cp $WORKSPACEDIR/.devcontainer/settings_local.py $WORKSPACEDIR/ietf/settings_local.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$WORKSPACEDIR/ietf/settings_local_debug.py" ]; then
|
||||||
|
echo "Setting up a default settings_local_debug.py ..."
|
||||||
|
cp $WORKSPACEDIR/.devcontainer/settings_local_debug.py $WORKSPACEDIR/ietf/settings_local_debug.py
|
||||||
|
fi
|
||||||
|
|
||||||
for sub in test/id/ test/staging/ test/archive/ test/rfc test/media test/wiki/ietf; do
|
for sub in test/id/ test/staging/ test/archive/ test/rfc test/media test/wiki/ietf; do
|
||||||
dir="$WORKSPACEDIR/$sub"
|
dir="$WORKSPACEDIR/$sub"
|
||||||
if [ ! -d "$dir" ]; then
|
if [ ! -d "$dir" ]; then
|
||||||
|
@ -141,7 +146,6 @@ chmod -R g+w /usr/local/lib/ # so we can patch libs if needed
|
||||||
|
|
||||||
cd "$WORKSPACEDIR" || cd "/home/$USER/"
|
cd "$WORKSPACEDIR" || cd "/home/$USER/"
|
||||||
|
|
||||||
echo "Done!"
|
|
||||||
if ! echo "$LANG" | grep "UTF-8"; then
|
if ! echo "$LANG" | grep "UTF-8"; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "Make sure you export LANG=en_GB.UTF-8 (or another UTF-8 locale) in your .bashrc"
|
echo "Make sure you export LANG=en_GB.UTF-8 (or another UTF-8 locale) in your .bashrc"
|
||||||
|
@ -153,6 +157,8 @@ HOME=/opt/home/$USER
|
||||||
|
|
||||||
/usr/local/bin/python $WORKSPACEDIR/ietf/manage.py check --settings=settings_local
|
/usr/local/bin/python $WORKSPACEDIR/ietf/manage.py check --settings=settings_local
|
||||||
|
|
||||||
|
echo "Done!"
|
||||||
|
|
||||||
# su -p $USER
|
# su -p $USER
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
|
@ -5,13 +5,15 @@ import six
|
||||||
if six.PY3:
|
if six.PY3:
|
||||||
from typing import Collection, Dict, List, Tuple # pyflakes:ignore
|
from typing import Collection, Dict, List, Tuple # pyflakes:ignore
|
||||||
|
|
||||||
|
from ietf.settings import * # pyflakes:ignore
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['*']
|
ALLOWED_HOSTS = ['*']
|
||||||
|
|
||||||
SECRET_KEY = 'jzv$o93h_lzw4a0%0oz-5t5lk+ai=3f8x@uo*9ahu8w4i300o6'
|
SECRET_KEY = 'jzv$o93h_lzw4a0%0oz-5t5lk+ai=3f8x@uo*9ahu8w4i300o6'
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'HOST': 'localhost',
|
'HOST': 'db',
|
||||||
'PORT': 3306,
|
'PORT': 3306,
|
||||||
'NAME': 'ietf_utf8',
|
'NAME': 'ietf_utf8',
|
||||||
'ENGINE': 'django.db.backends.mysql',
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
|
@ -61,5 +63,3 @@ SUBMIT_YANG_DRAFT_MODEL_DIR = 'data/developers/ietf-ftp/yang/draftmod/'
|
||||||
SUBMIT_YANG_INVAL_MODEL_DIR = 'data/developers/ietf-ftp/yang/invalmod/'
|
SUBMIT_YANG_INVAL_MODEL_DIR = 'data/developers/ietf-ftp/yang/invalmod/'
|
||||||
SUBMIT_YANG_IANA_MODEL_DIR = 'data/developers/ietf-ftp/yang/ianamod/'
|
SUBMIT_YANG_IANA_MODEL_DIR = 'data/developers/ietf-ftp/yang/ianamod/'
|
||||||
SUBMIT_YANG_RFC_MODEL_DIR = 'data/developers/ietf-ftp/yang/rfcmod/'
|
SUBMIT_YANG_RFC_MODEL_DIR = 'data/developers/ietf-ftp/yang/rfcmod/'
|
||||||
|
|
||||||
|
|
||||||
|
|
33
.devcontainer/settings_local_debug.py
Normal file
33
.devcontainer/settings_local_debug.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# Copyright The IETF Trust 2007-2019, All Rights Reserved
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from ietf.settings import INSTALLED_APPS, MIDDLEWARE
|
||||||
|
from ietf.settings_local import * # pyflakes:ignore
|
||||||
|
|
||||||
|
USE_DEBUG_TOOLBAR = True
|
||||||
|
|
||||||
|
INSTALLED_APPS = INSTALLED_APPS + ['debug_toolbar', ]
|
||||||
|
|
||||||
|
MIDDLEWARE = ['debug_toolbar.middleware.DebugToolbarMiddleware', ] + MIDDLEWARE
|
||||||
|
|
||||||
|
LOGGING = {
|
||||||
|
'version': 1,
|
||||||
|
'filters': {
|
||||||
|
'require_debug_true': {
|
||||||
|
'()': 'django.utils.log.RequireDebugTrue',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'handlers': {
|
||||||
|
'console': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'filters': ['require_debug_true'],
|
||||||
|
'class': 'logging.StreamHandler',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'loggers': {
|
||||||
|
'django.db.backends': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'handlers': ['console'],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
.vscode/launch.json
vendored
13
.vscode/launch.json
vendored
|
@ -16,6 +16,19 @@
|
||||||
"--settings=settings_local"
|
"--settings=settings_local"
|
||||||
],
|
],
|
||||||
"django": true
|
"django": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Run Server with Debug Toolbar",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"python": "/usr/local/bin/python",
|
||||||
|
"program": "${workspaceFolder}/ietf/manage.py",
|
||||||
|
"args": [
|
||||||
|
"runserver",
|
||||||
|
"0.0.0.0:8000",
|
||||||
|
"--settings=settings_local_debug"
|
||||||
|
],
|
||||||
|
"django": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -39,6 +39,7 @@ import datetime
|
||||||
import itertools
|
import itertools
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
|
from traceback import print_list
|
||||||
import markdown
|
import markdown
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
|
@ -63,7 +64,7 @@ import debug # pyflakes:ignore
|
||||||
|
|
||||||
from ietf.community.models import CommunityList, EmailSubscription
|
from ietf.community.models import CommunityList, EmailSubscription
|
||||||
from ietf.community.utils import docs_tracked_by_community_list
|
from ietf.community.utils import docs_tracked_by_community_list
|
||||||
from ietf.doc.models import DocTagName, State, DocAlias, RelatedDocument, Document
|
from ietf.doc.models import DocTagName, State, DocAlias, RelatedDocument, Document, Person
|
||||||
from ietf.doc.templatetags.ietf_filters import clean_whitespace
|
from ietf.doc.templatetags.ietf_filters import clean_whitespace
|
||||||
from ietf.doc.utils import get_chartering_type, get_tags_for_stream_id
|
from ietf.doc.utils import get_chartering_type, get_tags_for_stream_id
|
||||||
from ietf.doc.utils_charter import charter_name_for_group, replace_charter_of_replaced_group
|
from ietf.doc.utils_charter import charter_name_for_group, replace_charter_of_replaced_group
|
||||||
|
|
|
@ -9,6 +9,7 @@ from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||||
from django.views import static as static_view
|
from django.views import static as static_view
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
from django.views.defaults import server_error
|
from django.views.defaults import server_error
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
import debug # pyflakes:ignore
|
import debug # pyflakes:ignore
|
||||||
|
|
||||||
|
@ -89,3 +90,10 @@ if settings.SERVER_MODE in ('development', 'test'):
|
||||||
urlpatterns += static_url(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
urlpatterns += static_url(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
settings.DEBUG = save_debug
|
settings.DEBUG = save_debug
|
||||||
|
|
||||||
|
# Debug Toolbar
|
||||||
|
if hasattr(settings, 'USE_DEBUG_TOOLBAR') and settings.USE_DEBUG_TOOLBAR:
|
||||||
|
try:
|
||||||
|
import debug_toolbar
|
||||||
|
path('__debug__/', include(debug_toolbar.urls)),
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
Loading…
Reference in a new issue