NEWBIE: One Django Install Per Project ?

Sorry, I did not get off to a good start with the tutorial as i had installation problems covered in another unresolved post. I’m winging it with a book now by Mattes.

Am I understanding that for each Django project, we create an env AND a Django installation into that env , followed by a startproject .? I’m surprised we can’t just install Django once, if that is the case.

There’s nothing stopping you from installing Django globally on your system. However, if that’s the case & you have multiple Django projects, all of them would then depend on that version of Django & in many cases, it might happen that one project is just not ready to be upgraded to a newer version of the library & some other needs to be upgraded.

Therefore, it’s always best practice to create a virtual environment (through virtualenv, pipenv, poetry etc. any tool that suits you) for each of your Django projects and install Django there (so that you can full control of the Django version as well as any other dependencies of that project). And this is not just specific to Django, but for any serious Python project in general.

2 Likes

I would disagree that it’s always best practice to create a per-project virtual environment. If you have a group of related projects (Django and non-Django), where it’s important that the set of those projects all use the same versions of libraries, it’s a lot better to create a virtual environment external to any individual project.

2 Likes