lib#
Contains all Python packages installed in the virtual environment. Django and its dependencies are located in site-packages. This directory is automatically managed by pip.
π djenv/lib β what is it?#
lib/ is where all installed Python packages are stored for this virtual environment.
When you install Django, pip puts it here.
If bin/ is the engine, lib/ is the fuel + parts.
The structure may contains#
djenv/lib/
βββ python3.14/
βββ site-packages/
βββ asgiref/
βββ asgiref-3.11.0.dist-info/
βββ django/
βββ django-6.0.dist-info/
βββ pip/
βββ pip-25.3.dist-info/
βββ sqlparse/
βββ sqlparse-0.5.5.dist-info/
Letβs break this down piece by piece
1οΈβ£ python3.14/#
- This folder corresponds to the Python version used by the venv.
Your venv was created with Python 3.14
All packages are version-scoped
Prevents conflicts between Python versions
On another machine it might be python3.12 or python3.11.
2οΈβ£ site-packages/ (MOST IMPORTANT)#
- This is where:
Django lives
All third-party libraries live
Python imports from
When you write:
import django
Python looks here.
3οΈβ£ django/#
This is the Django framework source code.
Inside youβll find:
django/
βββ conf/
βββ db/
βββ http/
βββ urls/
βββ views/
βββ core/
βββ ...
This is what runs when:
python manage.py runserver
You normally do not edit this code.
4οΈβ£ django-6.0.dist-info/#
- Metadata about Django:
Version number
Dependencies
License
Installed files list
- Used by:
pip
package managers
dependency resolution
Not imported by Python directly.
5οΈβ£ asgiref/#
- ASGI utilities used by Django for:
Async views
WebSockets
ASGI servers
Django depends on this.
6οΈβ£ sqlparse/#
- Used by Django to:
Format SQL queries
Display readable SQL in admin/debug
Not written by Django, but required by it.
7οΈβ£ pip/ and pip-*.dist-info/#
pip itself lives inside the venv.
- This ensures:
pip installs packages into this venv
Not into global Python
- What NOT to do inside lib/
Donβt edit Django source
Donβt delete random folders
Donβt commit to Git
Donβt import .dist-info
If something breaks β recreate venv.
How Python actually uses lib/#
When venv is active:
python
Python automatically adds:
djenv/lib/python3.14/site-packages
to sys.path.
Thatβs how imports work.
What happens when you install a new package?
pip install psycopg2
- pip:
Downloads package
Installs it into site-packages
Adds .dist-info
Makes it importable