Home > Mobile >  Need help running an existing django project on a new machine
Need help running an existing django project on a new machine

Time:02-11

Im just starting to do some work with an already existing python django project. I just installed python in my machine and Im trying to figure out how to install django and as I see I am supposed to use pip for this.

However, in all tutorials people are firstly creating a virtual environment for it. Now my question is since the project already exists do I need to create a virtual environment from scratch? I can see that there is already a env folder which includes bin and lib folders.

Can I somehow use this environment? And if so are there some specific commands for that?

I am on windows by the way.

CodePudding user response:

A virtual env is somehow to isolate packages from your system python package. I recommend you learn about them https://docs.python.org/3/tutorial/venv.html

But maybe your current project uses another package manager, for instance pipenv or poetry. If so, you will need to find references on their doc (mostly, pipenv install or poetry install). With pip, people usually add dependencies on a file like requirements.txt, which you use with pip install -r requirements.txt

Usually, you don't add python environement on source control, so it might be that this env folder is for environement variables ?

Whatever, all you need is those packages installed (with pip, pipenv, or poetry), then you should be able to run the django server through either your IDE, either 'python manage.py runserver'.

If you see any missing package (like missing module XXX) simply install them with your package manager.

  • Related