Ask Your Question
0

mod_wsgi - Error

asked 2015-09-21 17:01:15 -0500

Hering gravatar image

updated 2015-09-22 00:49:31 -0500

Hello, I cloned Askbot 0.7.53 from github and deployed it under /var/www/html/askbot-devel on a system running Ubuntu 14.04 with Python 2.7.6.
Then I used pip install -r askbot_requirements.txt and followed the documentation about installing Askbot. When I run python manage.py runserver 127.0.0.1:8500 now everything seems to be fine except these messages in the error log:

/var/www/html/askbot-devel/askbot/skins/utils.py TIME: 2015-09-21 23:36:16,762 MSG: utils.py:get_media_url:159 missing media resource style/extra.css in skin default

Now I am trying to make it run with mod_wsgi. Therefore I compiled mod_wsgi with the installed python to make sure the versions match and added these lines to my 000-default.config for apache:

<VirtualHost *:80>
        ServerName askbot.localhost

        DocumentRoot /var/www/html/askbot-devel
        <Directory /var/www/html/askbot-devel>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>

        ##Askbot
        Alias /m/ /var/www/html/askbot-devel/static/
        Alias /upfiles/ /var/www/html/askbot-devel/askbot/upfiles/
        <DirectoryMatch "/var/www/html/askbot-devel/askbot/skins/([^/]+)/media">
            Order deny,allow
            Allow from all
        </DirectoryMatch>
        <DirectoryMatch "/var/www/html/askbot-devel/askbot/upfiles">
            Order deny,allow
            Allow from all
        </DirectoryMatch>
        WSGIDaemonProcess askbot
        WSGIProcessGroup askbot
        WSGIScriptAliasMatch / /var/www/html/askbot-devel/django.wsgi

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
 </VirtualHost>

This is what my settings.py looks like:

import os.path
import logging
import sys
import askbot
import site

sys.stderr.write('\n'.join(sorted(sys.path)) + '\n')

ASKBOT_ROOT = os.path.abspath(os.path.dirname(askbot.__file__))
site.addsitedir(os.path.join(ASKBOT_ROOT, 'deps'))

DEBUG = True
TEMPLATE_DEBUG = False
INTERNAL_IPS = ('127.0.0.1',)
ALLOWED_HOSTS = ['*',]

ADMINS = (
    ('Admins', 'bla@bla.bla'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': '#####',
        'USER': '#####',
        'PASSWORD': '#####',
        'HOST': '',
        'PORT': '', 
        'TEST_CHARSET': 'utf8',
        'TEST_COLLATION': 'utf8_general_ci',
    }
}

SERVER_EMAIL = ''
DEFAULT_FROM_EMAIL = ''
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_SUBJECT_PREFIX = ''
EMAIL_HOST=''
EMAIL_PORT=''
EMAIL_USE_TLS=False
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

IMAP_HOST = ''
IMAP_HOST_USER = ''
IMAP_HOST_PASSWORD = ''
IMAP_PORT = ''
IMAP_USE_TLS = False

TIME_ZONE = 'Europe/Berlin'

SITE_ID = 1

USE_I18N = True
LANGUAGE_CODE = 'de'

MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'askbot', 'upfiles')
MEDIA_URL = '/upfiles/'
STATIC_URL = '/m/'

PROJECT_ROOT = os.path.dirname(__file__)
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')

ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'

SECRET_KEY = '###########################'

TEMPLATE_LOADERS = (
    'askbot.skins.loaders.Loader',
    'django.template.loaders.app_directories.Loader',
    'django.template.loaders.filesystem.Loader',
)


MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
    'askbot.middleware.forum_mode.ForumModeMiddleware',
    'askbot.middleware.cancel.CancelActionMiddleware',
    'django.middleware.transaction.TransactionMiddleware',
    'askbot.middleware.view_log.ViewLogMiddleware',
    'askbot.middleware.spaceless.SpacelessMiddleware',
    'askbot.middleware.csrf.CsrfViewMiddleware',
)

ROOT_URLCONF = os.path.basename(os.path.dirname(__file__)) + '.urls'

FILE_UPLOAD_TEMP_DIR = os.path.join(
                                os.path.dirname(__file__),
                                'tmp'
                            ).replace('\\','/')

FILE_UPLOAD_HANDLERS = (
    'django.core.files.uploadhandler.MemoryFileUploadHandler',
    'django.core.files.uploadhandler.TemporaryFileUploadHandler',
)
ASKBOT_ALLOWED_UPLOAD_FILE_TYPES = ('.jpg', '.jpeg', '.gif', '.bmp', '.png', '.tiff')
ASKBOT_MAX_UPLOAD_FILE_SIZE = 1024 * 1024 #result in bytes
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.core.context_processors.request',
    'askbot.context.application_settings',
    'askbot.user_messages.context_processors.user_messages',
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.csrf',
    'askbot.deps.group_messaging.context.group_messaging_context ...
(more)
edit retag flag offensive close merge delete

Comments

We also get the message in our log 'missing media resource style/extra.css in skin default'. This does not appear to negatively affect us. Also did you remember to run the manage.py migrate, syncdb and collectstatic commands? - (even though it is a new install it may help). A better requirements list is here: https://github.com/ASKBOT/askbot-devel/blob/master/askbot/__init__.py. Ensure your coffin is version 0.3.8 (check carefully, pip lies) and django-robots is 1.0.

Rupreck gravatar imageRupreck ( 2015-09-22 03:14:21 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-09-22 22:33:48 -0500

Evgeny gravatar image

Try running the python manage.py runserver command (possibly with more parameters to specify the domain name).

If behavior is different with the runserver vs the instance deployed via the Apache or other web server (btw - nginx + uwsgi or gunicorn would be faster and use less RAM), then the issue must be with the python environment variables.

edit flag offensive delete link more

Comments

I integrated the old version inside our PHP-Application which is designed for the use with Apache ;) Therefore I cant use nginx or others. But as I said in my previous comment if I use 'runserver' it works perfectly fine. The fun part is that the old version is still working good with exactly the same configuration in apache on the same server with the same python. I didnt even touch the VirtualHost just changed the files to test it. I will try to search for the error and hopefully track it down but if someone knows the exact reason I would be really happy too ;)

Hering gravatar imageHering ( 2015-09-23 04:48:31 -0500 )edit
0

answered 2015-09-22 07:42:15 -0500

Hering gravatar image

updated 2015-09-22 09:10:15 -0500

Yes I fixed this extra.css -Error by simpy adding it and running python manage.py collectstatic again.
According to /usr/local/lib/python2.7/dist-packages (which are the same as pip list says) I have these requirements installed:

askbot-0.7.53
mod_wsgi-4.4.13.dist-info
psycopg2-2.6.1-info
virtualenv-13.1.2.dist-info

akismet-0.2.0
django_avatar-2.1.1
beautifulsoup4-4.4.0
Coffin-0.3.8.dist-info
django_compressor-1.2
Django-1.5
django_countries-3.3.dist-info
django_transaction_signals-1.0.0
django_celery-3.0.11
celery-3.1.18
django_kombu-0.9.4.dist-info
djkombu
django_followit-0.0.7
html5lib-0.90
Jinja2-2.8
jsonfield-1.0.3
longerusername-0.4
markdown2-2.3.0
_markerlib
MarkupSafe-0.23-linux-x86_64
mock-1.0.1
oauth2-1.9.0.post1
python_openid-2.2.5
django_picklefield-0.3.0
PyJWT-1.4.0
django_recaptcha_works-0.3.4
django_robots-1.0.dist-info
sanction-0.3.1
South-1.0.2
django_threaded_multihost-1.4_1
django_tinymce-1.5.1b2
Unidecode-0.04.18

Looking at the given list that should be alright, right?
I installed via these commands after cloning it into a folder:

python setup.py develop
virtualenv .
askbot-setup #Filling out all the stuff (Database exists and got filled)
python manage.py syncdb
python manage.py migrate askbot
python manage.py migrate django_authopenid
python manage.py collectstatic
chown -R www-data:www-data .

I have a feeling it got something to do with a wrong configuration in the virtual host or maybe the wrong mod_wsgi-Version but I am not sure.

edit flag offensive delete link more

Comments

If I run "python manage.py runserver 127.0.0.1:8500" it displays "Validating models... 0 errors found September 22, 2015 - 16:31:26 Django version 1.5, using settings 'askbot-devel.settings' Development server is running"

Hering gravatar imageHering ( 2015-09-22 09:34:37 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-09-21 17:01:15 -0500

Seen: 3,826 times

Last updated: Sep 22 '15