0

I have installed this https://github.com/andybak/django-backup

App just provides backup management command

What i do:

1. $ python manage.py backup

Everything is fine. Backup created!

2. $ python manage.py shell

from django.core.management import call_command
call_command('backup')

Everything is fine. Backup created!

3. I've created view:

from django.core.management import call_command

def backup(request): # /admin/backup/
    call_command('backup')
    return redirect(request.META.get('HTTP_REFERER'))

4. $ python manage.py runserver 0.0.0.0:9999

Go to browser mywebsite.com:9999/admin/backup/

Everything is fine. Backup created!

5. But when I run my website through nginx+gunicorn+supervisord and go to browser mywebsite.com/admin/backup/ - backup file is empty.

Maybe it is all about permissions? Please help.

Django 1.7


EDIT:

6. /var/env/project/bin/gunicorn core.wsgi -b 0.0.0.0:9999 --user=root --group=root and go to browser mywebsite.com:9999/admin/backup/

Everything is fine. Backup created!


/etc/supervisord.conf:

[program:project]
command=/var/env/project/bin/gunicorn core.wsgi -b 0.0.0.0:8000 --user=root --group=root
directory=/var/www/project/
environment=PATH="/var/env/project/bin/activate",DJANGO_SETTINGS_MODULE="core.settings_prod"
user=root
autostart=true
autorestart=true
redirect_stderr=true
4
  • 1
    yes, it's probably related to permission, check which user is used by gunicorn Commented Mar 27, 2015 at 14:23
  • user in gunicorn.conf Commented Mar 27, 2015 at 14:24
  • which user is executing the gunicorn and with which user do you test it manually? Commented Mar 27, 2015 at 14:37
  • manually: root ; I don't have gunicorn.conf, but in /etc/supervisord.conf: user=root Commented Mar 27, 2015 at 14:44

1 Answer 1

0

Got it! Mistake in supervisord.conf environment=PATH= it should be environment=PYTHONPATH=

environment=PYTHONPATH="/var/env/project/bin/activate",DJANGO_SETTINGS_MODULE="core.settings_prod"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.