Сломанный шаблон администратора Django при использовании uwsgi
Когда я запускаю свое приложение, используя python3 manage.py run server 0.0.0.0:8000
, я могу получить доступ к админке Django просто отлично.
Однако, когда я запускаю его с помощью uwsgi
шаблон Django admin сломан. Приложение работает нормально, но сайт отображается как простой текст, без шаблонов вообще. Например, вот страница входа в систему:
Как я могу это исправить?
Это мой uwsgi.ini
:
[uwsgi]
chdir = ./src
http = :8000
enable-threads = true
#harakiri = 300
master = true
module = config.wsgi:application
#processes = $(UWSGI_PROCESSES)
#threads = $(UWSGI_THREADS)
#max-worker-lifetime = $(UWSGI_MAX_WORKER_LIFE)
workers = 32
thunder-lock = true
vacuum = true
workdir = ./src
add-header = Connection: Keep-Alive
http-keepalive = 65000
max-requests = 50000
max-requests-delta = 10000
max-worker-lifetime = 360000000000 ; Restart workers after this many seconds
reload-on-rss = 2048 ; Restart workers after this much resident memory
worker-reload-mercy = 60 ; How long to wait before forcefully killing workers
# Increment the timeout to reach the target app.
# http-timeout = 60
lazy-apps = true
single-interpreter = true
ignore-sigpipe = true
ignore-write-errors = true
http-auto-chunked = true
disable-write-exception = true
Это settings.py
для моего приложения:
Также, вот консольные ошибки, которые я вижу в Safari:
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (base.css, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (nav_sidebar.css, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (nav_sidebar.js, line 0)
[Error] Refused to execute http://myip...:8000/static/admin/js/nav_sidebar.js as script because "X-Content-Type-Options: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'i.generateKey')
promiseEmptyOnRejected (content-script.js:75:780)
promiseReactionJob
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (login.css, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (responsive.css, line 0)
Я установил NGINX, и это помогло решить проблему. Однако я все еще не знаю, что вызвало проблему в первую очередь, и как решить ее без NGINX.