Skip to content

Instantly share code, notes, and snippets.

@4sskick
Last active March 19, 2022 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4sskick/9fa81bfc46c6bbc0779d37a756bb41e8 to your computer and use it in GitHub Desktop.
Save 4sskick/9fa81bfc46c6bbc0779d37a756bb41e8 to your computer and use it in GitHub Desktop.
These virtual environment seems less informative for me as beginner, compared to virtualenv which I installed [here](https://pythonbasics.org/virtualenv/)
To activate virtual environment, you need to go specific folder project. Then type `pipenv shell`
if there's no virtual env activated yet, output would become `Launching subshell in virtual environment...`
but if there's one activate already, would give an output `Shell for [location project] like C:\Users\monta\.virtualenvs\django-test-LGyddycI already activated`
When that's happen, you need to locate the orject which virtual env point on that location then type `exit`
YES! just type exit. If terminal you use not closed yet. Then virtual env the one activated already would become `deactivate` by doing that
NOW, let's go to basic.
HOW TO CREATE NEW PROJECT USING PIPENV
--------------------------------------
- first you need to install pipenv, type `pip install pipenv`
- go to project folder you want to create virtual env, then type `pipenv shell`. It will generate a new folder virtual environment on other location. On me, those are going located on C: drive
- on project folder would have 2 files (Pipfile & Pipfile.lock)
- then you good to go
INSTALL FROM EXISTING PROJECT (provided requirement.txt or pipfile)
-------------------------------------------------------------------
- sometime you downloaded project from open source
- then you found it only provide file requiremtn.txt instead of pipfile
- then just type `pipenv shell` on root project
- it will converting to generate pipfile on your workspace and activate virtual env for you
- continue with type command `pipenv install -r requirement.txt` it will install library which already pipfile generated from requirement.txt file
- wait until done, then you're good to go
- lasly type command, `python manage.py runserver` to make it run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment