настройка django в apache + centos 7 - PullRequest
1 голос
/ 09 мая 2019

Я попытался использовать Django на своем выделенном сервере, и у меня возникло несколько проблем, если кто-нибудь может помочь мне настроить Django на сервере Apache с использованием Python Centos 7, запущенного на сервере y, и когда

, я использую "Сервер запуска Django"в порту 0.0.0.0:8000 после активного источника он работает хорошо, но я не могу запустить Django на своем сервере apache. Я думал, что проблема может быть в том, что у меня нет WSGI, но я даже не знаю, как его настроить. Я запускаюэтот комментарий в моем корне

"pip install mod_wsgi"

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting mod_wsgi
  Using cached https://files.pythonhosted.org/packages/47/69/5139588686eb40053f8355eba1fe18a8bee94dc3efc4e36720c73e07471a/mod_wsgi-4.6.5.tar.gz
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-f6NC1P/mod-wsgi/setup.py", line 168, in <module>
        'missing Apache httpd server packages.' % APXS)
    RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites inthe documentation for this package and install any missing Apache httpd server packages.
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-f6NC1P/mod-wsgi/

далее, я попробовал sudo yum install mod_wsgi -y

Loaded plugins: fastestmirror, langpacks, universal-hooks
Loading mirror speeds from cached hostfile
 * EA4: 104.219.172.10
 * cpanel-addons-production-feed: 104.219.172.10
 * cpanel-plugins: 104.219.172.10
 * base: repos-lax.psychz.net
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: mirrors.usc.edu
 * ius: mirrors.kernel.org
 * updates: mirror.fileplanet.com
Resolving Dependencies
--> Running transaction check
---> Package mod_wsgi.x86_64 0:3.4-18.el7 will be installed
--> Processing Dependency: httpd-mmn = 20120211x8664 for package: mod_wsgi-3.4-18.el7.x86_64
--> Finished Dependency Resolution
Error: Package: mod_wsgi-3.4-18.el7.x86_64 (base)
           Requires: httpd-mmn = 20120211x8664
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

мой первый вопрос - это яустановить в моей системе wsgi или нет, и если у меня есть следующий шаг - настроить мой сервер apache, то когда я создаю файл django.conf в моей папке etc, то следующий вопрос - я проверяю все застрявшие переполнения в настройках моего сервера apache и всеони не работают для меня, мой django.conf находится в "/etc/httpd/conf.d"

<virtualHost *:80>
 ServerAdmin webmaster@mysite.com
 ServerName  djangotest.mysite.com
 DocumentRoot /home/user6/public_html/djangotest.mysite.com/httdocs
 ErrorLog   /var/log/httpd/djangotest.mysite.com-error.log
 CustomLog  /var/log/httpd/djangotest.mysite.com-access.log combined
 WSGIScriptAlias / /home/user6/public_html/django1/djangotest/djangotest/wsgi.py
</VirtualHost>

WSGIPythonPath /home/user6/public_html/django1/djangotest/djangotest

# Further relax access to the default document root:
<Directory "/home/sites/djangotest.mysite.com//htdocs">
        Option Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>
<Directory "/home/user6/django1/djangotest/djangotest">
        <Files wsgi.py>
                Require all granted
        </Files>
</Directory>

Я использую inmotion хостинг выделенного сервера, когда я набираю python и следую этому

python
>>> import django
>>> django.VERSION

ррезультат -

[root@ded4729 conf.d]# python
Python 2.7.5 (default, Apr  9 2019, 14:30:50)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.VERSION
(1, 11, 20, u'final', 0)
>>>

и еще раз на практике сервер, мое приложение работает хорошо, и проблема в том, что я не могу запустить его в apache с centos

...