Статические файлы AWS lightsail django не загружаются с помощью apache

#python #django #apache #bitnami #amazon-lightsail

#питон #джанго #апач #битнами #амазонка-световой парус

Вопрос:

Я создал проект django в AWS lightsail, в котором используется bitnami. Я смог загрузить свой проект, но когда я попытался получить доступ к общедоступному ip-адресу, который мне был предоставлен, это привело к некоторой ошибке в моем браузере, и журнал ошибок был

 Exception ignored in: lt;function Local.__del__ at 0x7f923d359550gt; Traceback (most recent call last):  File "/opt/bitnami/python/lib/python3.8/site-packages/asgiref/local.py", line 96, in __del__ NameError: name 'TypeError' is not defined Exception ignored in: lt;function Local.__del__ at 0x7f923d359550gt; Traceback (most recent call last):  File "/opt/bitnami/python/lib/python3.8/site-packages/asgiref/local.py", line 96, in __del__ NameError: name 'TypeError' is not defined [Thu Dec 02 08:25:01.082092 2021] [mpm_event:notice] [pid 18334:tid 140267253222272] AH00491: caught SIGTERM, shutting down [Thu Dec 02 08:25:01.259848 2021] [ssl:warn] [pid 18855:tid 140702045899648] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name [Thu Dec 02 08:25:01.269998 2021] [ssl:warn] [pid 18856:tid 140702045899648] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name [Thu Dec 02 08:25:01.270771 2021] [mpm_event:notice] [pid 18856:tid 140702045899648] AH00489: Apache/2.4.51 (Unix) OpenSSL/1.1.1d mod_wsgi/4.7.1 Python/3.8 configured -- resuming normal operations [Thu Dec 02 08:25:01.270797 2021] [core:notice] [pid 18856:tid 140702045899648] AH00094: Command line: '/opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf' [Thu Dec 02 08:25:16.600738 2021] [authz_core:error] [pid 18858:tid 140701463279360] [client 185.220.101.170:29682] AH01630: client denied by server configuration: /opt/bitnami/projects/myproject/static/plugins/fontawesome-free/css/all.min.css, referer: http://public_ipaddres/ [Thu Dec 02 08:25:16.898619 2021] [authz_core:error] [pid 19143:tid 140701358606080] [client 185.220.101.170:16764] AH01630: client denied by server configuration: /opt/bitnami/projects/myproject/static/plugins/select2/css/select2.min.css, referer: http://public_ipaddres/ [Thu Dec 02 08:25:16.899763 2021] [authz_core:error] [pid 18859:tid 140701463279360] [client 185.220.101.170:21798] AH01630: client denied by server configuration: /opt/bitnami/projects/myproject/static/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css, referer: http://public_ipaddres/  

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

Вот мой bitnami.conf

 lt;VirtualHost _default_:80gt;  WSGIScriptAlias / /opt/bitnami/projects/myproject/wsgi.py    lt;Directory /opt/bitnami/projects/myproject/gt;  AllowOverride all  Require all granted  Options FollowSymlinks  lt;/Directorygt;    DocumentRoot /opt/bitnami/projects/myproject/  Alias /static/ /opt/bitnami/projects/myproject/static/ lt;/VirtualHostgt;   Include "/opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf"  

вот мой httpd-app.conf

 lt;IfDefine !IS_DJANGOSTACK_LOADEDgt;  Define IS_DJANGOSTACK_LOADED  WSGIDaemonProcess wsgi-djangostack processes=2 threads=15 display-name=%{GROUP} lt;/IfDefinegt;  lt;Directory "/opt/bitnami/projects/myproject"gt;  Options  MultiViews  AllowOverride All  lt;IfVersion gt;= 2.3gt;  Require all granted  lt;/IfVersiongt;   WSGIProcessGroup wsgi-djangostack   WSGIApplicationGroup %{GLOBAL} lt;/Directorygt;  Alias /static/ '/opt/bitnami/projects/myproject/static/' WSGIScriptAlias /myproject/ '/opt/bitnami/projects/myproject/wsgi.py'  

Вот мой wsgi.py

 import os  from django.core.wsgi import get_wsgi_application  os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')  application = get_wsgi_application()  

In the browser sample of the error are

 Content Security Policy: The page’s settings blocked the loading of a resource at http://public_ipaddres/static/tinymce/tinymce.min.js (“script-src”). Content Security Policy: The page’s settings blocked the loading of a resource at http://public_ipaddres/static/plugins/bootstrap/js/bootstrap.bundle.min.js (“script-src”).   GET http://public_ipaddres/static/plugins/fontawesome-free/css/all.min.css Status 403 Forbidden Version HTTP/1.1  

предупреждения являются

 Content Security Policy: Couldn’t process unknown directive ‘script-src-elem’ Password fields present on an insecure (http://) page. This is a security risk that allows user login credentials to be stolen  

Я пробовал это в течение нескольких дней.