0

I have deployed a Django app using Apache2 and it works fine.

However when I add either REST framework or logging the app doesn't respond properly.

To note is that all works fine using 'manage.py runserver'. I just fails running under Apache2.

The problems are

REST The service doesn't recognize JSON input and accepts anything typed in the web interface input box despite having JSON selected as the input. Whatever is typed just gives back a 201 response despite having a working serialiser in place.

Logging The whole application doesn't boot when logging is in the settings.py file. If I comment it out it boots fine. Again it works in the demo server setup.

Apache2 Config

<VirtualHost *:80>

WSGIScriptAlias / /home/user/portal_interface/portal/wsgi.py

    Alias /static /home/user/portal_interface/interface/static

    <Directory /home/user/portal_interface/interface/static>
            Require all granted
    </Directory>

    <Directory /home/user/portal_interface/portal>
            <Files wsgi.py>
                    Require all granted
            </Files>
    </Directory>

    WSGIDaemonProcess portal python-path=/home/user/portal_interface:/var/www/sampleapp/env/lib/python2.7/site-packages
    WSGIProcessGroup portal

</VirtualHost>

Logging

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
    'file': {
        'level': 'DEBUG',
        'class': 'logging.FileHandler',
        'filename': os.path.join(BASE_DIR, 'debug.log'),
    }
},
'loggers': {
    'django': {
        'handlers': ['file'],
        'level': 'DEBUG',
        'propagate': True,
    }
  }
}
Spinnaay
  • 119
  • 1
  • 12

1 Answers1

0

I have managed to fix the REST element of this question.

I wasn't serving static files for the REST framework.

By following steps online to collect static files and adjust the Apache2 config to reflect the new position of static files the problem seems to have fixed itself.

Missing bootstrap resources in Django-Rest-Framework

This must have had something to do with javascript files used in the REST process.

No update on logging.

Spinnaay
  • 119
  • 1
  • 12