requirement.txt
- Open a terminal/command prompt and navigate to your Django project directory.
- Activate your virtual environment (if you are using one).
- Use the
pip freezecommand to generate a list of all installed packages and their versions:
Copy
pip freeze > requirements.txt
This command will save the output of pip freeze to a file named requirements.txt.
Your requirements.txt file is now ready and should contain a list of all packages installed in your virtual environment along with their version numbers.
Note that it’s a good practice to regularly update your requirements.txt file to include any new packages or updates to existing packages that you may have installed in your project.