моя конфигурация apache не работает, получая ошибку «500 Internal server error» - PullRequest
0 голосов
/ 27 октября 2019

Я пытаюсь развернуть мой проект django на apache2, но он выдает ошибку «500 внутренняя ошибка сервера».

Вот мой конфигурационный файл myproject.conf

<VirtualHost *:80>
    ServerAdmin amol@myfirstdjango.localhost
    ServerName myfirstdjango.localhost
    ServerAlias www.myfirstdjango.localhost
    DocumentRoot /var/www/lms_project/Django-CRM
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /static /var/www/lms_project/static

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

    Alias /static /var/www/lms_project/media
    <Directory /var/www/lms_project/media>
        Require all granted
    </Directory>

    <Directory /var/www/lms_project/Django-CRM/crm>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    WSGIDaemonProcess lms_project python-path=/var/www/lms_project python-home=/var/www/lms_project/env
    WSGIProcessGroup lms_project
    WSGIScriptAlias / /var/www/lms_project/Django-CRM/crm/wsgi.py
</VirtualHost>

myпроект находится в

/ var / www / lms_project / Django-CRM # эта папка содержит manage.py

виртуальная среда находится в / var / www / lms_project

мой лог apache

[Sun Oct 27 21:00:36.472014 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628] wtforms.validators.ValidationError: The CSRF session token is missing.
[Sun Oct 27 21:00:36.472022 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628] 
[Sun Oct 27 21:00:36.472030 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628] During handling of the above exception, another exception occurred:
[Sun Oct 27 21:00:36.472038 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628] 
[Sun Oct 27 21:00:36.472046 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628] Traceback (most recent call last):
[Sun Oct 27 21:00:36.472054 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628]   File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1947, in full_dispatch_request
[Sun Oct 27 21:00:36.472062 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628]     rv = self.preprocess_request()
[Sun Oct 27 21:00:36.472069 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628]   File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2241, in preprocess_request
[Sun Oct 27 21:00:36.472077 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628]     rv = func()
[Sun Oct 27 21:00:36.472084 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628]   File "/usr/lib/python3/dist-packages/flask_wtf/csrf.py", line 221, in csrf_protect
[Sun Oct 27 21:00:36.472092 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628]     self.protect()
[Sun Oct 27 21:00:36.472100 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628]   File "/usr/lib/python3/dist-packages/flask_wtf/csrf.py", line 252, in protect
[Sun Oct 27 21:00:36.472108 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628]     self._error_response(e.args[0])
[Sun Oct 27 21:00:36.472115 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628]   File "/usr/lib/python3/dist-packages/flask_wtf/csrf.py", line 295, in _error_response
[Sun Oct 27 21:00:36.472124 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628]     raise CSRFError(reason)
[Sun Oct 27 21:00:36.472134 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628] flask_wtf.csrf.CSRFError: 400 Bad Request: The CSRF session token is missing.
[Sun Oct 27 21:00:36.472147 2019] [wsgi:error] [pid 3409:tid 139766507882240] [remote ::1:43628] 
[Sun Oct 27 21:00:38.472027 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630] 2019-10-27 21:00:38,471: ERROR\tpgadmin:\t400 Bad Request: The CSRF session token is missing.
[Sun Oct 27 21:00:38.472236 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630] Traceback (most recent call last):
[Sun Oct 27 21:00:38.472355 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]   File "/usr/lib/python3/dist-packages/flask_wtf/csrf.py", line 249, in protect
[Sun Oct 27 21:00:38.472406 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]     validate_csrf(self._get_csrf_token())
[Sun Oct 27 21:00:38.472443 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]   File "/usr/lib/python3/dist-packages/flask_wtf/csrf.py", line 87, in validate_csrf
[Sun Oct 27 21:00:38.472475 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]     raise ValidationError('The CSRF session token is missing.')
[Sun Oct 27 21:00:38.472524 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630] wtforms.validators.ValidationError: The CSRF session token is missing.
[Sun Oct 27 21:00:38.472555 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630] 
[Sun Oct 27 21:00:38.472585 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630] During handling of the above exception, another exception occurred:
[Sun Oct 27 21:00:38.472618 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630] 
[Sun Oct 27 21:00:38.472650 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630] Traceback (most recent call last):
[Sun Oct 27 21:00:38.472679 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]   File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1947, in full_dispatch_request
[Sun Oct 27 21:00:38.472712 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]     rv = self.preprocess_request()
[Sun Oct 27 21:00:38.472741 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]   File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2241, in preprocess_request
[Sun Oct 27 21:00:38.472772 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]     rv = func()
[Sun Oct 27 21:00:38.472801 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]   File "/usr/lib/python3/dist-packages/flask_wtf/csrf.py", line 221, in csrf_protect
[Sun Oct 27 21:00:38.472834 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]     self.protect()
[Sun Oct 27 21:00:38.472864 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]   File "/usr/lib/python3/dist-packages/flask_wtf/csrf.py", line 252, in protect
[Sun Oct 27 21:00:38.472897 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]     self._error_response(e.args[0])
[Sun Oct 27 21:00:38.472927 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]   File "/usr/lib/python3/dist-packages/flask_wtf/csrf.py", line 295, in _error_response
[Sun Oct 27 21:00:38.472941 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630]     raise CSRFError(reason)
[Sun Oct 27 21:00:38.472954 2019] [wsgi:error] [pid 3409:tid 139766684317440] [remote ::1:43630] flask_wtf.csrf.CSRFError: 400 Bad Request: The CSRF session token is missing.
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...