A
A
Alexey2016-04-29 16:32:26
Django
Alexey, 2016-04-29 16:32:26

How to deploy Django on httpd, mod_wsgi, django, virtualenv server?

Good afternoon!
The second day I can not figure out the problem that has arisen (500 error), can anyone tell me what the problem is?
website: server5.diamis.ru
error log:

[Fri Apr 29 09:14:35.764746 2016] [:error] [pid 32561] [remote 178.252.111.100:112] mod_wsgi (pid=32561): Target WSGI script '/var/www/virtual/python3.4/proect/parser/SpiderSite/wsgi.py' cannot be loaded as Python module.
[Fri Apr 29 09:14:35.764773 2016] [:error] [pid 32561] [remote 178.252.111.100:112] mod_wsgi (pid=32561): Exception occurred processing WSGI script '/var/www/virtual/python3.4/proect/parser/SpiderSite/wsgi.py'.
[Fri Apr 29 09:14:35.764793 2016] [:error] [pid 32561] [remote 178.252.111.100:112] Traceback (most recent call last):
[Fri Apr 29 09:14:35.764808 2016] [:error] [pid 32561] [remote 178.252.111.100:112]   File "/var/www/virtual/python3.4/proect/parser/SpiderSite/wsgi.py", line 17, in <module>
[Fri Apr 29 09:14:35.764869 2016] [:error] [pid 32561] [remote 178.252.111.100:112]     application = get_wsgi_application()
[Fri Apr 29 09:14:35.764879 2016] [:error] [pid 32561] [remote 178.252.111.100:112]   File "/var/www/virtual/python3.4/lib/python3.4/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Fri Apr 29 09:14:35.764894 2016] [:error] [pid 32561] [remote 178.252.111.100:112]     django.setup()
[Fri Apr 29 09:14:35.764900 2016] [:error] [pid 32561] [remote 178.252.111.100:112]   File "/var/www/virtual/python3.4/lib/python3.4/site-packages/django/__init__.py", line 17, in setup
[Fri Apr 29 09:14:35.764910 2016] [:error] [pid 32561] [remote 178.252.111.100:112]     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Fri Apr 29 09:14:35.764916 2016] [:error] [pid 32561] [remote 178.252.111.100:112]   File "/var/www/virtual/python3.4/lib/python3.4/site-packages/django/conf/__init__.py", line 55, in __getattr__
[Fri Apr 29 09:14:35.764924 2016] [:error] [pid 32561] [remote 178.252.111.100:112]     self._setup(name)
[Fri Apr 29 09:14:35.764930 2016] [:error] [pid 32561] [remote 178.252.111.100:112]   File "/var/www/virtual/python3.4/lib/python3.4/site-packages/django/conf/__init__.py", line 43, in _setup
[Fri Apr 29 09:14:35.764938 2016] [:error] [pid 32561] [remote 178.252.111.100:112]     self._wrapped = Settings(settings_module)
[Fri Apr 29 09:14:35.764943 2016] [:error] [pid 32561] [remote 178.252.111.100:112]   File "/var/www/virtual/python3.4/lib/python3.4/site-packages/django/conf/__init__.py", line 99, in __init__
[Fri Apr 29 09:14:35.764950 2016] [:error] [pid 32561] [remote 178.252.111.100:112]     mod = importlib.import_module(self.SETTINGS_MODULE)
[Fri Apr 29 09:14:35.764956 2016] [:error] [pid 32561] [remote 178.252.111.100:112]   File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
[Fri Apr 29 09:14:35.764967 2016] [:error] [pid 32561] [remote 178.252.111.100:112]     __import__(name)
[Fri Apr 29 09:14:35.764985 2016] [:error] [pid 32561] [remote 178.252.111.100:112]   File "/var/www/virtual/python3.4/proect/parser/SpiderSite/settings.py", line 138
[Fri Apr 29 09:14:35.764989 2016] [:error] [pid 32561] [remote 178.252.111.100:112] SyntaxError: Non-ASCII character '\\xd0' in file /var/www/virtual/python3.4/proect/parser/SpiderSite/settings.py on line 138, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

httpd config (/etc/httpd/conf.d/wsqi.conf):
<VirtualHost *:80>
        ServerName server5.diamis.ru

        <Directory /var/www/virtual/python3.4/proect/parser/>
                Order allow,deny
                Allow from all
        </Directory>

        WSGIDaemonProcess server5.diamis.ru user=python group=python processes=5 threads=1 python-path=/var/www/virtual/python3.4/proect/parser/:/var/www/virtual/python3.4/lib/python3.4/site-packages/
        WSGIProcessGroup server5.diamis.ru

        WSGIScriptAlias / /var/www/virtual/python3.4/proect/parser/SpiderSite/wsgi.py

        #WSGIPythonPath /var/www/python/parser/

        # статичные файлы
        Alias /static/ /var/www/virtual/python3.4/proect/parser/static/
        Alias /robots.txt /var/www/virtual/python3.4/proect/parser/static/robots.txt

        <Directory /var/www/virtual/python3.4/proect/parser/SpiderSite/>
                Order deny,allow
                Allow from all
        </Directory>

        # LOG
        CustomLog /var/log/httpd/python.access.log combined
        ErrorLog /var/log/httpd/python.error.log
</VirtualHost>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2016-04-29
@MrSen

# -*- coding: utf-8 -*-
in SpiderSite/settings.py in the first line write

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question