简体   繁体   English

如何在Ubuntu 11.10上安装Django?

[英]How do I install Django on Ubuntu 11.10?

I'm using The Definitive guide to installing Django on ubuntu and ironically need something more definitive because I can't make it work. 我正在使用The Definitive指南在ubuntu上安装Django ,具有讽刺意味的是需要一些更明确的东西,因为我无法使它工作。

(I have followed the steps before this on the link above) (我在上面的链接上按照前面的步骤操作)

Here is my situation/standstill: 这是我的情况/停顿:

drewverlee@ubuntu:/var/src$ tar xzvf Django-1.3.1.tar.gz
tar (child): Django-1.3.1.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

So it tells me there is no file Django-1.3.1.tar.gz? 所以它告诉我没有文件Django-1.3.1.tar.gz? I think I can check for a file by us by: 我想我可以通过以下方式检查文件:

drewverlee@ubuntu:/var/src$ ls
index.html  index.html.1
drewverlee@ubuntu:/var/src$

What do I need to do? 我需要做什么?

pip is best tool for installing python packages. pip是安装python包的最佳工具。 Here is link to install setup-tools and pip on ubuntu. 这是在ubuntu上安装setup-tools和pip的链接

If you have installed pip then it will be very easy to install django and other python packages. 如果你已经安装了pip,那么安装django和其他python包将非常容易。

$ sudo pip install django

or for a specific version of django 或者对于特定版本的django

$ sudo pip install django==1.3.1

If you're using ubuntu, then you can just use the package provided in the repositories: 如果您使用的是ubuntu,那么您只需使用存储库中提供的包:

$ sudo apt-get install python-django
...
$ python -c 'import django; print django.get_version()'
1.3

if you have easy_install: 如果你有easy_install:

easy_install django

and for a specific version: 对于特定版本:

easy_install django==1.#.#

Indeed, following the link I get the same problem, first. 实际上,在链接后我得到了同样的问题,首先。

mv index.html Django-1.3.1.tar.gz

fixes it for me. 为我修复它。 Then you can continue with 然后你可以继续

tar xzvf Django-1.3.1.tar.gz

Any guide that doesn't include virtualenv and virtualenvwrapper isn't definite enough for me :) Seriously, it will save you from a world of pain. 任何不包括virtualenv和virtualenvwrapper的指南对我来说都不够明确:)严肃地说,它会让你远离痛苦的世界。

Also nginx + gunicorn now seems to be the default method for serving up django rather then Apache + mod_wsgi, but I'd say that that's less definite. 另外nginx + gunicorn现在似乎是提供django而不是Apache + mod_wsgi的默认方法,但我会说那不太明确。

1) download Django-1.3.1.tar.gz https://www.djangoproject.com/download/ 1)下载Django-1.3.1.tar.gz https://www.djangoproject.com/download/

2) go into directory with the file 2)进入目录与文件

tar xzvf Django-1.3.1.tar.gz
cd Django-1.3.1
sudo python setup.py install

3) check if python sees django 3)检查python是否看到django

>>> python
>>>import django
>>>print django.get_version()

After that you get Aptana as IDE to work with django 之后,您将Aptana作为IDE与django一起使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM