已解決:在vps中部署django

在虛擬專用服務器 (VPS) 上部署 Django 的主要問題是它可能會佔用大量資源。 這是因為 Django 需要大量的內存和 CPU 資源才能正常運行。

I have a problem with my Django project. I'm trying to deploy it on my VPS, but I can't get it to work.
This is the error that I get:
<code>    Traceback (most recent call last):
  File "/home/myuser/.local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/myuser/.local/lib/python3.6/site-packages/django/utils/deprecation.py", line 93, in __call__
    response = self.get_response(request)
  File "/home/myuser/.local/lib//python3.6//site-packages//django//core//handlers//base.py", line 126, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/myuser/.local//python3.6//site-packages///django///core///handlers///base.py", line 124, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  ...

  File "/usr / local / lib / python3 . 6 / site - packages / django / core / management / base . py " , line 371 , in execute     output = self . handle ( * args , ** options )   File "./manage . py" , line 72 , in handle     execute_from_command _line ( sys . argv )   File "/usr // local // lib // python3 . 6 // site - packages /// django /// core /// management /// __init__ . py " , line 363 , in execute _from _command _line utility . execute ()   File "/usr // local // lib // python3 . 6 // site - packages /// django /// core /// management /// __init__ . py " , line 355 , in execute self . fetch _command ( subcommand ). run _from _argv ( self . argv )   File "/usr // local // lib // python3 . 6 // site - packages /// django /// core /// management /** init**" , line 206 , in fetch _command klass = load _command class ( appname ) KeyError : 'demo' [ 04 : 19 : 10 web1 : 1805 ] [ WSGI ] Error getting traceback from worker process : &lt; type 'exceptions' &gt;: 'module' object has no attribute 'wsgi' [ 04 : 19 : 10 web1 : 1805 ] [ WSGI ] Traceback from worker process &lt; type 'exceptions' &gt;: 'module' object has no attribute 'wsgi' [ 04 : 19 : 10 web1 : 1805 ] [ WSGI ] Traceback from worker process &lt; type 'exceptions' &gt;: 'module' object has no attribute 'wsgi'. wsgi application 1 init failed ; not restarting ...</code>

該代碼試圖在 VPS 上部署 Django 項目,但出現錯誤。 錯誤是“wsgi”應用程序未正確初始化。

什麼是 VPS

VPS 是虛擬專用服務器。 它是一種服務器,允許您運行自己的網站或應用程序。

Django 的最佳 VPS

這個問題沒有確定的答案,因為它取決於 Django 項目的具體需求。 但是,Django VPS 提供商的一些流行選擇包括 Heroku、Amazon Web Services (AWS) 和 Google Cloud Platform (GCP)。 每個都有自己的優點和缺點,因此仔細考慮哪個最適合特定項目很重要。

選擇 Django VPS 提供商時要考慮的一些關鍵因素包括:

1. 操作系統:大多數 Django VPS 提供商都提供一系列不同的操作系統,因此選擇一個符合您項目要求的操作系統非常重要。 例如,GCP 同時支持 Linux 和 Windows,而 AWS 同時提供 Windows 和 Linux 選項。

2. CPU 和內存:Django VPS 應該有足夠的 CPU 能力和內存來處理您的項目的需求。 例如,GCP 提供比 AWS 更強大的 CPU 和更大的內存池,而 AWS 提供功率更低的 CPU,但內存分配更慷慨。

3. 安全:選擇具有強大安全措施的供應商很重要。 例如,GCP 提供強大的安全功能,例如加密數據存儲和通過雙因素身份驗證 (2FA) 進行的用戶身份驗證。 AWS 也提供了一些安全功能,但它們可能並不適合所有項目。

相關文章:

發表評論