Closed ReyRen closed 3 years ago
本地的可以改host文件,不过只是自欺欺人了,只在本机有效
服务器需要自己另外部署
服务器需要自己另外部署
本身就是在服务器上部署的,但是默认监听是http://127.0.0.1:8000, 想要更改127.0.0.1为指定云主机域名或IP即可。问题就是在哪里能改这个默认监听的IP地址
可以自行查询 Django 部署教程,应该会用到 Uwsgi 和 Nginx
我看了下我之前的参考链接,正在审核中😅 https://www.jianshu.com/p/f1ed50f22d07
好的,谢谢
以前的笔记,供参考
conda install -c conda-forge uwsgi
conda install -c conda-forge libiconv
# test.py
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b"Hello World"] # python3
uwsgi --http :8000 --wsgi-file test.py
local machine browse ip:8000
to check. Should see Hello World
.
uwsgi --http :8889 --module WordReview.wsgi
now we did not load the static files
pip install supervisor
sudo apt-get install python3-dev nginx
cp /etc/nginx/uwsgi_params ./WordReview/
configure WordReview/nginx.conf
sudo ln -s /home/spa/site/New_Media_Info_Website_SPA/WordReview/WR_snginx.conf /etc/nginx/sites-enabled/
python3 manage.py collectstatic
sudo service nginx restart
# if bug then run the line below
# sudo service nginx start
uwsgi --socket WordReview.sock --module WordReview.wsgi --chmod-socket=662
python3 manage.py collectstatic
sudo service nginx restart
# if bug then run the line below
# sudo service nginx start
这其实是一个提问, 但不知提问位置是否正确
功能描述 在哪里更改可替换默认打开IP为指定域名或IP, 而非http://127.0.0.1
希望这个功能可以解决:(可选)
用于共有云服务器上使用
感谢!