Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to activate Virtual Environment in DJango

I am currently on Windows and the Venv is not getting activatedUnactivated ENV, Is there any way to fix this. Thanking you guys in advance! Help out a newbie!

like image 363
RoosyDepp Avatar asked Dec 01 '22 09:12

RoosyDepp


2 Answers

In windows: Press Windows (or Windows+R) and then type “cmd”: Run the Command Prompt in normal mode.

  1. cd C:\Users\user\Desktop\UserDjangoProject> pip install virtualenv
  2. For Create a venv run this virtualenv -p python3 venv
  3. Activate virtualenv venv\Scripts\activate
  4. It will look like this (venv) C:\Users\user\Desktop\UserDjangoProject>
  5. Then run pip install -r requirements.txt
  6. Run the django project run this./manage.py runserver
like image 82
Shariful Islam Avatar answered Dec 04 '22 01:12

Shariful Islam


In Linux/Mac, go to the project folder (in which, there should be env folder created).

. my_env_name/bin/activate

In Windows, go to the project folder (in which, there should be env folder created).

my_env_name\Scripts\activate
like image 24
Somnath Muluk Avatar answered Dec 03 '22 23:12

Somnath Muluk