Skip to content

Commit

Permalink
I hope that finally fix admin user issue
Browse files Browse the repository at this point in the history
  • Loading branch information
deniszh committed Jul 11, 2020
1 parent d55c2ba commit 88f81a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 30 deletions.
9 changes: 1 addition & 8 deletions conf/etc/service/graphite/run
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ export DJANGO_SETTINGS_MODULE=graphite.settings
/opt/graphite/bin/django-admin.py makemigrations
/opt/graphite/bin/django-admin.py migrate auth
/opt/graphite/bin/django-admin.py migrate --run-syncdb
if [ -e "/opt/graphite/storage/graphite.db" ]; then
# if graphite use sqlite database - create superuser
if grep ENGINE /opt/graphite/webapp/graphite/local_settings.py | grep -q django.db.backends.sqlite3; then
/opt/graphite/bin/django_admin_init.exp
fi
fi
/opt/graphite/bin/django_admin_init.sh || true

if folder_empty /opt/graphite/webapp/graphite/functions/custom; then
touch /opt/graphite/webapp/graphite/functions/custom/__init__.py
Expand All @@ -42,8 +37,6 @@ export GRAPHITE_WSGI_REQUEST_LINE=${GRAPHITE_WSGI_REQUEST_LINE:-0}
export GRAPHITE_WSGI_MAX_REQUESTS=${GRAPHITE_WSGI_MAX_REQUESTS:-1000}
export GRAPHITE_WSGI_WORKER_CLASS=${GRAPHITE_WSGI_WORKER_CLASS:-"sync"}
export GRAPHITE_WSGI_WORKER_CONNECTIONS=${GRAPHITE_WSGI_WORKER_CONNECTIONS:-1000}
export PYTHONPATH=/opt/graphite/webapp

if [ "${GRAPHITE_WSGI_WORKER_CLASS}" == "gevent" ]; then
export GUNICORN_EXTRA_PARAMS="--worker-connections=${GRAPHITE_WSGI_WORKER_CONNECTIONS} "
else
Expand Down
22 changes: 0 additions & 22 deletions conf/opt/graphite/bin/django_admin_init.exp

This file was deleted.

10 changes: 10 additions & 0 deletions conf/opt/graphite/bin/django_admin_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

cat <<EOF | python3 /opt/graphite/bin/django-admin.py shell
from django.contrib.auth import get_user_model
User = get_user_model() # get the currently active user model
User.objects.filter(username='root').exists() or \
User.objects.create_superuser('root', '[email protected]', 'root')
EOF

0 comments on commit 88f81a4

Please sign in to comment.