n5321 | 2024年11月19日 16:53

Tags:


-XAn7Z4EshFGnQ6d

https://nihaoshudong.com

https://helloshudong.com

cd ~/myprojectdir

source myprojectenv/bin/activate

source myprojectenv/bin/activate

cd ~/myprojectdir
gunicorn --bind 0.0.0.0:8000 myproject.wsgi
gunicorn替换内置开发服务器。

Note: The admin interface will not have any of the styling applied since Gunicorn does not know how to find the static CSS content responsible for this.

这个时候就存在CSS、js丢失的问题。

接下来配置gunicorn,先要deactive

deactivate

sudo nano /etc/systemd/system/gunicorn.socket

You have tested that Gunicorn can interact with our Django application, but you should now implement a more robust way of starting and stopping the application server. To accomplish this, you’ll make systemd service and socket files.

这两个东西好像很关键。

  1. database: postgresql

  2. gunicorn application server

    1. you will install and configure the Gunicorn application server. This will serve as an interface to our application, translating client requests from HTTP to Python calls that our application can process.

  3. nginx to reverse proxy to gunicorn.

    1. You will then set up Nginx in front of Gunicorn to take advantage of its high performance connection handling mechanisms and its easy-to-implement security features.

124.220.90.88