Quantcast
Channel: The Jackal's Adventure » Code
Viewing all articles
Browse latest Browse all 4

Django and Virtual Environments – A Better Understanding I hope!

$
0
0

So I was messing around with Django the past week and somehow something got screwed up and I ceased to be able to operate my project on one of the environments I created. With Ryo’s help, I cleaned up my system, took out a lot junk from my local machine which I had inadvertently installed in my foray into coding and command line adventures.

I cleaned up completely my local machine from Django, reinstalled python3 etc etc. Also went back into my environments and uninstalled + reinstalled Django. My project worked fine again after that! Thank goodness.

So basically below is a rehash of what Ryo mentioned to me (as you can see, I like doing tables like these and have been doing a lot of them in my previous work!). When playing with Django, having a virtualenv is good practice. This is to remove dependence from the local machine and preventing any unsavoury writes in to the local machine.

mac1Django is installed within the virtual environment. No copies of it should float around in the local MAC (like I had previously). Below illustrates the linking of each virtual environment to the python version of your choice.

mac2The beauty : you get to remove the entire environment easily and create new ones to run your project. When these are done properly, the django project cannot run when you’re outside the virtual environment as Django is not installed in local Mac.

mac3Before this I was naive and thought that my Django project resided within the virtual environment that I created the project in. This is not true of course. The project remains safe and can be run from any of the virtual environments created…..provided of course, the necessary libraries required by the project are all there.


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images