Внутренняя ошибка сервера Django при доступе к сайту - PullRequest
0 голосов
/ 25 октября 2019

Я разместил свой сайт Django на машине с Linux. Я также предоставил все необходимые разрешения для моего каталога проекта. Но когда я пытаюсь получить доступ к сайту из моего браузера, я получаю сообщение об ошибке

    Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache/2.4.29 (Ubuntu) Server at li1988-26.members.linode.com Port 80

на странице.

Это структура моего проекта

/var/www/Intranet/

├── db.sqlite3
├── Intranet
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-36.pyc
│   │   ├── settings.cpython-36.pyc
│   │   ├── urls.cpython-36.pyc
│   │   └── wsgi.cpython-36.pyc
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── mainapp
│   ├── admin.py
│   ├── apps.py
│   ├── __init__.py
│   ├── migrations
│   │   ├── __init__.py
│   │   └── __pycache__
│   │       └── __init__.cpython-36.pyc
│   ├── models.py
│   ├── __pycache__
│   │   ├── admin.cpython-36.pyc
│   │   ├── __init__.cpython-36.pyc
│   │   ├── models.cpython-36.pyc
│   │   ├── urls.cpython-36.pyc
│   │   └── views.cpython-36.pyc
│   ├── static
│   │   └── mainapp
│   │       ├── css
│   │       │   └── base.css
│   │       └── js
│   │           └── base.js
│   ├── templates
│   │   └── mainapp
│   │       ├── base.html
│   │       └── homepage.html
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── manage.py
├── media
│   └── users
│       └── images
│           └── default.jpg
├── static
│   ├── admin
│   └── mainapp
│       ├── css
│       │   └── base.css
│       └── js
│           └── base.js
└── users
    ├── admin.py
    ├── apps.py
    ├── __init__.py
    ├── migrations
    │   ├── 0001_initial.py
    │   ├── __init__.py
    │   └── __pycache__
    │       ├── 0001_initial.cpython-36.pyc
    │       └── __init__.cpython-36.pyc
    ├── models.py
    ├── __pycache__
    │   ├── admin.cpython-36.pyc
    │   ├── __init__.cpython-36.pyc
    │   ├── models.cpython-36.pyc
    │   └── views.cpython-36.pyc
    ├── static
    ├── templates
    │   └── users
    │       ├── change_password.html
    │       ├── login.html
    │       ├── logout.html
    │       ├── password_change_done.html
    │       ├── password_reset_complete.html
    │       ├── password_reset_confirm.html
    │       ├── password_reset_done.html
    │       └── password_reset.html
    ├── tests.py
    └── views.py

Это мой /etc/apache2/sites-available/000-default.conf:

<VirtualHost *:80>
ServerName li1988-26.members.linode.com

ErrorLog ${APACHE_LOG_DIR}/mysite-error.log
CustomLog ${APACHE_LOG_DIR}/mysite-access.log combined

WSGIDaemonProcess mysite processes=2 threads=25 python-path=/var/www/Intranet
WSGIProcessGroup mysite
WSGIScriptAlias / /var/www/Intranet/Intranet/wsgi.py

Alias /robots.txt /var/www/Intranet/static/robots.txt
Alias /favicon.ico /var/www/Intranet/static/favicon.ico
Alias /static/ /var/www/Intranet/static/
Alias /static/ /var/www/Intranet/media/

<Directory /var/www/Intranet/Intranet>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

<Directory /var/www/Intranet/static>
    Require all granted
</Directory>

<Directory /var/www/Intranet/media>
    Require all granted
</Directory>

И тогда я дал команду

a2ensite 000-default.conf
sudo service apache2 restart

В журнале ошибок nano /var/log/apache2/error.log написано

[Fri Oct 25 09:12:51.993097 2019] [mpm_event:notice] [pid 16523:tid 140088200727488] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Fri Oct 25 09:12:51.993178 2019] [core:notice] [pid 16523:tid 140088200727488] AH00094: Command line: '/usr/sbin/apache2'
[Fri Oct 25 09:18:42.041782 2019] [mpm_event:notice] [pid 16523:tid 140088200727488] AH00493: SIGUSR1 received.  Doing graceful restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
[Fri Oct 25 09:18:42.063081 2019] [mpm_event:notice] [pid 16523:tid 140088200727488] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Fri Oct 25 09:18:42.063104 2019] [core:notice] [pid 16523:tid 140088200727488] AH00094: Command line: '/usr/sbin/apache2'
[Fri Oct 25 09:22:13.165844 2019] [mpm_event:notice] [pid 16523:tid 140088200727488] AH00493: SIGUSR1 received.  Doing graceful restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
[Fri Oct 25 09:22:13.359270 2019] [mpm_event:notice] [pid 16523:tid 140088200727488] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Fri Oct 25 09:22:13.359309 2019] [core:notice] [pid 16523:tid 140088200727488] AH00094: Command line: '/usr/sbin/apache2'
[Fri Oct 25 09:22:48.864610 2019] [mpm_event:notice] [pid 16523:tid 140088200727488] AH00493: SIGUSR1 received.  Doing graceful restart

Я испробовал все решения, которые я получил в качестве предложения по этому вопросу, но ни одно из них не помогло мне.

РЕДАКТИРОВАТЬ 2: Обновление журнала ошибок Apache

   [Sat Oct 26 06:25:02.373002 2019] [mpm_event:notice] [pid 22161:tid 139856591948736] AH00489: Apache/2.4.29 (Ubuntu) mo$[Sat Oct 26 06:25:02.373042 2019] [core:notice] [pid 22161:tid 139856591948736] AH00094: Command line: '/usr/sbin/apach$
   [Sat Oct 26 19:46:25.042037 2019] [mpm_event:notice] [pid 22161:tid 139856591948736] AH00491: caught SIGTERM, shutting $
   [Sat Oct 26 19:46:25.116742 2019] [mpm_event:notice] [pid 25602:tid 140008539728832] AH00489: Apache/2.4.29 (Ubuntu) mo$
   [Sat Oct 26 19:46:25.116818 2019] [core:notice] [pid 25602:tid 140008539728832] AH00094: Command line: '/usr/sbin/apach$

1 Ответ

0 голосов
/ 25 октября 2019

После устранения проблемы вместе, это был mod_wsgi, который не был установлен должным образом. только для будущих ссылок

...