【发布时间】:2015-04-01 00:11:55
【问题描述】:
我是 Django 和 Python 安装的新手。 Ubuntu 14.04 中级。
这些是我目前在 Ubuntu 14.04 中的安装。
apt-get install python3-setuptools --force-yes -y ## for python3
easy_install3 pip ## for python3
apt-get install python-setuptools --force-yes -y ## for python2.7 or above
easy_install pip ## for python2.7 or above
apt-get install python-dev --force-yes -y ## because ubuntu 14.04 does not have dev version of python 2
apt-get install python3-dev --force-yes -y ## because ubuntu 14.04 does not have dev version of python 3.4
apt-get install links --force-yes -y ##a command line web browser
apt-get install python-flup --force-yes -y ## connects python to uwsgi)
apt-get install build-essential --force-yes -y ##
pip2 install django uwsgi virtualenv ## use pip to install django and uwsgi and virtualenv for python2
pip3 install django uwsgi ## use pip to install django and uwsgi for python3
完整名单请看https://gist.github.com/simkimsia/41c55e0c08eda42e2cb3#file-install-sh-L88
我对@987654323@的使用感到困惑。
我想尽可能为 Django 1.7 的生产级别准备我的 ubuntu 14.04 服务器版本。
我安装多个 Python 环境的原因是因为我可能正在运行其他需要 3.4 的 Python 应用程序。
我的 Django 文件来自 bitbucket 存储库,我已将它们克隆到 /var/virtual/WebApps/DjangoProject
在/var/virtual/WebApps/DjangoProject里面,我有manage.py等文件和文件夹。
请告知我如何让 Django 项目在这种情况下运行。
我目前正在我的 virtualbox 和 vagrant 上测试此设置。
编辑
至少有 2 个 Django 应用程序。 1 需要 2.7 python。另一个需要3.4 python。
让我补充一点,这是一个单独的服务器,将托管应用程序、前端和数据库。
编辑 1
我重新安装了 Ubuntu 14.04,并开始使用 Python 2.7.6 和 Python 3.4.0。
然后我做了sudo apt-get install python-virtualenv,我检查了它的版本:1.11.4。
我创建了~/virtualenvs/py2.7 和~/virtualenvs/py3.4。
在~/virtualenvs 里面,我做了virtualenv -p /usr/bin/python2 py2.7
和~/virtualenvs,我做了virtualenv -p /usr/bin/python3 py3.4
那么如何为 python 2 应用程序安装仅 python2 的库?
例如分别是django-adminfiles、sorl-thumbnail、psycopg2
编辑 5
改用virtualenv --system-site-packages -p /usr/bin/python2 py2.7
【问题讨论】:
标签: django ubuntu nginx virtualenv uwsgi