ubuntu一步一步搭建django网站

前端之家收集整理的这篇文章主要介绍了ubuntu一步一步搭建django网站前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.安装 Nginx

apt-get update

apt install Nginx-full

2.安装uwsgi

apt install uwsgi

3.安装pyenv

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
exec "$SHELL"

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev

4.安装python3.6.1

pyenv install 3.6.1
pyenv gloabl 3.6.1

5.安装Postgresql数据库

vim /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main
  • 导入存储库签名密钥,并更新软件包列表
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
  sudo apt-key add -
sudo apt-get update
  • 安装
apt-get install postgresql-10

6.安装django

pip install django
pip install djangorestframework
pip install psycopg2 #postgresql数据库驱动
原文链接:https://www.f2er.com/ubuntu/350816.html

猜你在找的Ubuntu相关文章