简体   繁体   中英

Getting started with Django on Virtualbox>Vagrant>Ubuntu. Can't run django-admin

I have a Virtual Box machine with Ubuntu installed. I also use vagrant.

I am trying to get started with Django. I have followed the steps in: https://docs.djangoproject.com/en/dev/intro/install/

More specifically I have performed the following steps:

1. Install pip

    1. Download get-pip.py
    2. $ sudo python get-pip.py
    3. $ python get-pip.py

2. Install virtualenv

    1. sudo pip install virtualenv
    2. virtualenv env --always-copy


3. Install Git

    1. $ sudo apt-get update
    2. $ sudo apt-get install git

4. Get Django into virtualenv

    1. $ cd /vagrant
    2. $ git clone git://github.com/django/django.git

So far so good. But in the build your own app tutorial I get a problem with the following command:

$ django-admin startproject mysite

I get the error message:

The program 'django-admin' is currently not installed. To run 'django-admin' please ask your administrator to install the package 'python-django'

How can I get past this obstacle?

You haven't done step 4. You have not installed Django, let alone within a virtualenv; all you've done is clone the Django repo, which is unnecessary.

For step 4, you need to create a virtualenv, activate it, and install Django inside it using pip.

virtualenv my_django_proj
cd my_django_proj
source bin/activate
pip install django

Now, django-admin startproject mysite will work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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