解決済み: 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は仮想プライベートサーバーです。 独自の Web サイトやアプリケーションを実行できるサーバーの一種です。

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 は、暗号化されたデータ ストレージや 2 要素認証 (XNUMXFA) によるユーザー認証などの堅牢なセキュリティ機能を提供します。 AWS もいくつかのセキュリティ機能を提供していますが、すべてのプロジェクトに適しているとは限りません。

関連記事:

コメント