Umair
Umair

Reputation: 89

How to create a Django Virtual Environment offline?

I am trying to build a Django virtual environment on my PC that is not connected to Internet. I have Miniconda installed on the PC. When I run this command:

conda create --name MyDjangoEnv django

I get an error "Conda http error" and it says that I cannot connect to https://www.anaconda.com. Do i need to download any packages from the Internet to make it work?

Upvotes: 0

Views: 721

Answers (2)

Giordano
Giordano

Reputation: 5570

In order to install python packages into your pc using miniconda, connection is needed, because you need to download it and then install.

If you need to install an additional package like Django, I suggest to proceed in this way:

Step1: create a new conda virtualenv with the following command:

conda create --name MyDjangoEnv

If you need to use a specific Python version use the following command:

conda create --name MyDjangoEnv python=x.y

where x.y is for example 3.5

Step2: activate the enviroment just created with the following command:

conda activate MyDjangoEnv

Step3: Install Django with the following command:

conda install django

Step4: Try to run the runserver and if are missing other package you can install them with command:

conda install <package>

Upvotes: 0

girijesh96
girijesh96

Reputation: 455

Step 1: Open your command prompt and Install virtualenv using

pip install virtualenv

Step 2: Create a virtualenv for your django application

virtualenv your_virtual_env_name

Step 3: Activate your virtualenv using

your_virtual_env_name\Scripts\activate

Step 4: Install Django

pip install Django

After this, you can follow this to work on Django

Upvotes: 2

Related Questions