Django ကို virtual သီးသန့်ဆာဗာ (VPS) တွင်အသုံးပြုခြင်း၏အဓိကပြဿနာမှာ၎င်းသည်အရင်းအမြစ်-အသုံးအများဆုံးဖြစ်နိုင်သည်။ အဘယ်ကြောင့်ဆိုသော် Django သည် ကောင်းမွန်စွာလည်ပတ်ရန်အတွက် memory နှင့် 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 : < type 'exceptions' >: 'module' object has no attribute 'wsgi' [ 04 : 19 : 10 web1 : 1805 ] [ WSGI ] Traceback from worker process < type 'exceptions' >: 'module' object has no attribute 'wsgi' [ 04 : 19 : 10 web1 : 1805 ] [ WSGI ] Traceback from worker process < type 'exceptions' >: 'module' object has no attribute 'wsgi'. wsgi application 1 init failed ; not restarting ...</code>
ကုဒ်သည် VPS တွင် Django ပရောဂျက်ကို အသုံးချရန် ကြိုးစားနေသော်လည်း အမှားအယွင်းရှိနေပါသည်။ အမှားအယွင်းက 'wsgi' အပလီကေးရှင်းသည် မှန်ကန်စွာ အစပျိုးနေခြင်းမဟုတ်ခြင်းကြောင့် ဖြစ်သည်။
VPS ဆိုတာဘာလဲ
VPS သည် virtual private server တစ်ခုဖြစ်သည်။ ၎င်းသည် သင့်ကိုယ်ပိုင် ဝဘ်ဆိုဒ် သို့မဟုတ် အက်ပ်လီကေးရှင်းကို လုပ်ဆောင်ရန် ခွင့်ပြုသည့် ဆာဗာအမျိုးအစားဖြစ်သည်။
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 နှင့် memory- Django VPS သည် သင့်ပရောဂျက်၏ တောင်းဆိုချက်များကို ကိုင်တွယ်ရန် လုံလောက်သော CPU ပါဝါနှင့် မမ်မိုရီ ရှိသင့်သည်။ ဥပမာအားဖြင့်၊ GCP သည် AWS ထက် ပိုမိုအားကောင်းသော CPU များနှင့် ပိုကြီးသော memory pool များကို ပေးစွမ်းသော်လည်း AWS သည် စွမ်းဆောင်ရည်နိမ့် CPU များကို ပေးစွမ်းသော်လည်း ပိုမိုရက်ရောသော memory ခွဲဝေပေးပါသည်။
3. လုံခြုံရေး- လုံခြုံရေးအစီအမံများ အခိုင်အမာရှိသည့် ဝန်ဆောင်မှုပေးသူကို ရွေးချယ်ရန် အရေးကြီးပါသည်။ ဥပမာအားဖြင့်၊ GCP သည် ကုဒ်ဝှက်ထားသောဒေတာသိုလှောင်မှုနှင့် two-factor authentication (2FA) မှတစ်ဆင့် အသုံးပြုသူအထောက်အထားစိစစ်ခြင်းကဲ့သို့သော ခိုင်မာသောလုံခြုံရေးအင်္ဂါရပ်များကို ပေးပါသည်။ AWS သည် လုံခြုံရေးအင်္ဂါရပ်အချို့ကိုလည်း ပေးစွမ်းသော်လည်း ၎င်းတို့သည် ပရောဂျက်အားလုံးအတွက် မသင့်လျော်ပေ။