B
B
bituke2021-05-28 09:52:14
Django
bituke, 2021-05-28 09:52:14

How to find out what libraries are used in the project if there is no requirements.txt file?

I found one project, which of course has a lot of libraries and no requirements.txt file, I need to create this file, I tried to do it through pip freeze, but it does not see any libraries. How can this problem be solved?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2021-06-02
@bituke

bituke pip freeze needs to be run on the server where the project is currently running. If you download it to your computer and execute pip freeze, then of course you will not get anything. If there is no access to the server, then the actions are as follows:
1. In the settings.py file at the top there is an indication of the version of Django, something like this "Generated by 'django-admin startproject' using Django 2.2.16." Let's take version 2.2.16 as an example.
2. On the site https://pypi.org/ we find the Django package, then go to the "Release History", we find version 2.2.16 there, date September 1, 2020.
3. We go around the entire site code and look for package imports there, for example, from celery import shared_task. So the project uses the celery package.
4. Go to https://pypi.org/and find the celery package, then go to "Release History", and look for the latest version that was released before September 1, 2020, for us it is version 3.1 from August 4, 2020.
Steps 3 and 4 are repeated until all dependencies are installed.

A
Altry, 2021-05-28
@Altry

pip freeze > requirements.txt
You need to specify where to freeze.
Or if you found it on the git, maybe there is a venv folder, and you can find all installed packages in it. But this is unlikely.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question