Forums

Cloned my entire Django repo, but can't employ the code, even though my depo included the virtualenv

Title says everything. I can't employ my Django webpage, even though I cloned my entire Django repo (which included my virtualenv that works on my computer). I just get an ImportError complaning that I have no module named apps, and I don't even know what that means. Can anyone help me?

There are a couple of possibilities about why it might not work, but I think the first one to address is the virtualenv.

A virtualenv created on one computer is generally unlikely to work on another. It's not a proper self-contained system image, like a Docker container -- it has links going out to various system tools, and if those are in different places on PythonAnywhere to where they are on your local machine, it won't work. For that reason, it's not standard practice to include them in the repo -- instead, you include a requirements.txt file that specifies what packages you need, then build a virtualenv outside the repo on each machine you're running on, using pip install -r requirements.txt to install all of the appropriate stuff into it.

So the first thing to do is to rebuild the virtualenv on PythonAnywhere and then specify the new virtualenv on the "Web" tab.

That might not make it work right away, but it will get rid of one major cause of errors, and we'll be here to help if there are still problems :-)